Mexico chose as its new president Sunday Enrique Peña Nieto, a dashing, disciplined campaigner who promised to bring peace and prosperity back to a country weary of drug violence and slow growth, according to official results.

As the new face of a political party once known for corruption, Peña Nieto and his Institutional Revolutionary Party (PRI), completed a remarkable act of political rehabilitation, returning to power after 12 years on the sidelines.

To chants of “Presidente! Presidente!” from a roaring crowd at his political party’s headquarters in Mexico City, Peña Nieto strode to the stage just before midnight for his victory speech. With the kind of messaging, discipline and stagecraft that have marked his campaign from the beginning, the 45-year-old former governor insisted “Mexico won today” — repeating a new catchphrase already printed on banners for the event.

“There’s no going back to the past,” Peña Nieto said, promising a break with the old autocratic style of his PRI forefathers, known in Mexico as the dinosaurs, in favor of a “modern, democratic, transparent” presidency.

“We are a new generation,” he said.

Projected results gave Peña Nieto roughly 38 percent of the vote, trailed by leftist Andres Manuel Lopez Obrador, who won 31 percent. The official government projections, based on a sample of polling stations, had a margin of error of 0.5 percent, said top election official Leonardo Valdes.

“Mexico had an exemplary election day,” said Valdes, adding that voting had proceeded “normally” despite reports of violence, cheating and polling irregularities.

More than 49 million Mexicans voted Sunday, he said — a 62 percent turnout rate and “more votes than any election in Mexican history.”

After the official projection of victory for Peña Nieto was announced, Lopez Obrador addressed his supporters but did not concede the election. “The last word has not been spoken,” the former Mexico City mayor promised.

As he spoke, he smiled and seemed serene, and not defiant. “The position we assume now is to wait, until we have all of the results,” Lopez Obrador said. “There is a legal procedure. We will scrutinize the results district by district. There is information we have that indicates something different than the official results.”

In 2006, Lopez Obrador suffered a razor thin loss to President Felipe Calderon, and he and his supporters cried foul and fraud. AMLO had himself declared “the legitimate president” of Mexico as his constituents took to the streets for weeks of protest in Mexico City.

For his part, Calderon addressed the nation and praised his fellow citizens for participating in a free and fair election “that took place in a climate of peace and tranquility in most of the country.”

Calderon said that final results would come soon, but based on the preliminary count, Peña Nieto will be the next president of Mexico. “So I congratulate him sincerely,” Calderon said, “and my government has a complete willingness to collaborate with his team in an orderly, transparent and efficient transition.”

Calderon said, “in a democracy, there are no permanent victories and no permanent defeats.”

Calderon was ineligible for reelection. The constitution limits chief executives to a single six-year term.

Still, the election was a clear vote of no confidence for Calderon and his ruling National Action Party (PAN) after 12 years in power. The PAN candidate, Josefina Vazquez Mota, a former education secretary, finished a distant third.

In her concession speech, hours before the official tally was released, Vazquez Mota said, “Mexico is better off today than it was 12 years ago.” She told a demoralized-looking crowd of PAN followers, “Now it’s up to us to preserve what we’ve accomplished together.”

In other races, exit polls suggested that the PRI would pick up at least one more governor’s post, giving the party control of 21 of Mexico’s 31 states.

In the megalopolis of Mexico City, Miguel Angel Mancera captured 60 percent of the vote, allowing the left to continue to run one of the largest and most complex cities in the world.

When Peña Nieto assumes the presidency in December, he will inherit the grinding, bloody confrontation against Mexico’s drug cartels that consumed Calderon’s term and left 60,000 dead.

Electoral officials praised the day’s voting as a sign of a maturing democracy. Of nearly 143,000 balloting places, only two precincts did not open to receive ballots, a record in a country with 80 million registered voters, said Edmundo Jacobo, executive secretary of the Federal Electoral Institute.

The election was not free of violence. The Mexican army deployed troops to the village of Rincon Chamula in the southern state of Chiapas to put down a confrontation between members of the PRI and the Green Party. Initial reports say three people were killed and two were wounded. The parties were members of the same electoral alliance in the national elections.

In Monterrey, Mexico’s third-largest city, armed men stormed into a polling station just before closing time and hijacked the ballot boxes. There were other reports of violence and intimidation.

Jacobo said officials have received 1,500 complaints — including insufficient ballots and not enough ink to mark fingers — which is less than half of the complaints registered in the last general election in 2006.

The special prosecutor for electoral crimes said he was investigating 15 incidents of voter fraud, including the arrest of a man in Veracruz who allegedly was trying to buy a voter ID for $60. In another case, a top operative of the front-running party cut in line to vote and was booed by those waiting.

A Twitter-driven student movement that arose in opposition to Peña Nieto, #YoSoy132, compiled long lists of irregularities, fraud allegations and acts of violence Sunday, and said it would challenge the outcome.

Anne-Marie O’Connor and Gabriela Martinez contributed to this report.