Mexico's old guard sailed back into power after a 12-year hiatus as the official preliminary vote count handed a victory to Enrique Peña Nieto, whose party was long accused of ruling the country through corruption and patronage.

The second-placed candidate, leftist Andres Manuel Lopez Obrador, refused to concede defeat, saying he would wait for a full count.

The Federal Electoral Institute's representative count said Mr Peña Nieto of the Institutional Revolutionary Party (PRI) won about 38% of the vote, prompting wild cheers from a group that was voted out in 2000 after 71 years in power when Mexicans became weary of what critics called autocratic and corrupt rule.

Mr Lopez Obrador of the Democratic Revolution Party had 31% and Josefina Vazquez Mota of the ruling National Action Party had about 25%, according to the institute.

Mr Peña Nieto called his victory "a fiesta of democracy".

"There is no return to the past," said the youthful, 45-year-old who is married to a soap opera star. "You have given our party a second chance and we will deliver results."

He promised a government that would be democratic, modern and open to criticism. He pledged to fight organised crime and said there would be no pacts with criminals. He added: "My gratitude tonight is for the millions of Mexican who voted for me. I will work for all of Mexico ... I will govern for everyone."

Despite a clear victory, more than 60% of voters did not support him and it was not the mandate the PRI had anticipated based on the pre-election polls.

Ms Vazquez Mota, 51, was the first to concede, followed by New Alliance candidate Gabriel Quadri, who had only single-digit support.

At the PRI headquarters in Mexico City, a fiesta atmosphere broke out with supporters in red dancing to norteño music.

There were plenty of reasons to celebrate. The party also appeared likely to retake at least one of the two houses of Congress and some governorships.

Critics said the party's 71-year rule was characterised by authoritarian and corrupt practices. But the PRI has sought to portray itself as a group that has been modernised and does not seek a return to its old ways.

Mr Lopez Obrador took hundreds of thousands of supporters to the streets in protest when he narrowly lost in 2006.

The PRI has been bolstered by voter fatigue due to a sluggish economy and the sharp escalation of a drug war that has killed roughly 50,000 Mexicans over the past six years.

Hugo Rubio, 33, a municipal employee in Nezalhualcoyotl, says what he expects is "more jobs, more tranquillity in terms of security" under Mr Peña Nieto.

"He has demonstrated that the party had changed, that he cares about the people who are most in need," Mr Rubio said as red-clad PRI supporters gathered with banners and balloons.

There were very few reports of problems during the vote, though some polling stations ran out of ballots and at least nine people were arrested in the southern state of Chiapas for trying to pass ballots pre-marked for the PRI.

Interior Secretary Alejandro Poire said that across the country federal security forces were working closely with local and state authorities, as well as electoral officials, to guard the peace during the vote.