Conservative candidate Felipe Calderon has won Mexico's presidential election, according to preliminary results.
The election is the first since the PRI party lost power after 71 years
Electoral authorities give Mr Calderon the narrowest of margins of just over 1% ahead of his leftist rival, Andres Manuel Lopez Obrador.
But Mr Obrador said there had been inconsistencies in the voting returns and that he would challenge a victory by Mr Calderon.
The results will not be verified until a final count later this week.
"I won the election... it is irreversible," Mr Calderon of the National Action Party (Pan) told Mexican television.
But Mr Lopez Obrador, of the Party of the Democratic Revolution (PRD) said he would not accept "what we all know is a preliminary result," the AFP news agency reported.
"There are many inconsistencies," the agency quoted him as saying.
The preliminary results issued by the Federal Electoral Institute (IFE) gave Mr Calderon 36.38% of the vote compared with 35.34% for Mr Lopez Obrador.
The IFE said the verification process would begin on Wednesday.
If Mr Calderon's win is confirmed, the victory will halt the rise of the so-called left in Latin America, and the US will continue to have a like-minded administration on its southern border, the BBC's Duncan Kennedy in Mexico City says.
The outcome of the vote is being watched closely throughout the Americas but is of special concern to the US, where migration from Mexico is a key issue.
Officials say turnout was high, after a lengthy campaign marked by political insults and accompanied by a rise in drug violence.
The leading candidates have been offering alternative visions of how to create jobs and boost the economy.
Among the 70 million people eligible to vote were thousands in the US, after a decision to allow Mexicans living abroad to vote for the first time.
In congressional elections, with 80% of polling stations reporting, the Pan was in line to win the most seats but to fall well short of gaining a majority in either house.
The Institutional Revolutionary Party (PRI), which ruled Mexico for 71 years, was set to fall into third place in Congress for the first time.
The election has been portrayed as a fight between left and right, a choice between more state intervention or the continuation of free market policies, our correspondent says.
Mr Lopez Obrador is a former mayor of Mexico City, who has championed the poor and promised major public building programmes.
Mr Calderon is a Harvard-educated former government minister who calls for more foreign investment and greater links to the global economy.
The preliminary results show a third candidate, the PRI's Roberto Madrazo, trailing with 21.57% of the vote.