Mr Lopez Obrador rejected the electoral commission's announcement that his rival had pipped him to the presidency by just 0.57 per cent of the votes. He promised to take his allegations of fraud to Mexico's highest electoral court, the federal election tribune, and demand a manual recount of all 41 million ballots cast on Sunday.
If he follows through on his words, the best-case scenario is weeks of uncertainty and legal wrangling.
The stand-off could also spill over into the streets. Mr Lopez Obrador, the austere but charismatic former mayor of Mexico City whose "Robin Hood" campaign focused on lifting the poor and dismantling the privileges of the country's elite, has deep support in the capital, which he can quickly mobilise. The 52-year-old leader of the Party of the Democratic Revolution would have little difficulty plunging much of the country into weeks of civil and possibly violent disobedience if he chose to.
Last night he ordered his backers to rally in the main square, the Zocalo, on Saturday to protest against the result. He has form: in 1994, after losing a crooked Tabasco governor's race, his supporters blockaded the plaza to prevent the winning candidate from taking office.
"We cannot accept these results," he said yesterday. "We are always going to act in a responsible manner, but at the same time, we have to defend the citizens' will."
The count began Wednesday and continued through the night into yesterday. Mr Lopez Obrador was particularly enraged because in the first hours of returns he held a surprise lead. But as results came in from the more conservative north of the country, home to tough entrepreneurs, the balance tipped towards his opponent from the ruling National Action Party.
With all the ballots counted, Mr Calderon had 35.88 per cent (14,981,268 votes) to Mr Lopez Obrador's 35.31 per cent (14,745,262). Roberto Madrazo, whose Institutional Revolutionary Party controlled Mexico for 71 years until the victory of the current President, Vicente Fox, in 2000, had just over 22 per cent.
In theory, the stand-off could drag on in the courts until early September, when the electoral commission is legally required to declare a winner. The successor to Mr Fox will be inaugurated on 1 December.
The seemingly victorious Mr Calderon, 43, a stiff Harvard-educated economist who was always the favourite of most of Mexico's business community and its wealthier classes, appealed for unity. "If the contest is behind us, our differences are behind us," he insisted. "Now is the hour for unity and agreements between Mexicans."
There was little sign of investors taking the threat of legal challenges seriously: the stock markets and the peso soared on news that Mr Calderon was heading for victory. His win will also draw a sigh of relief from Washington, which has been watching nervously to see if Mexico would swing to the left in the footsteps of other countries in the region, including Argentina, Bolivia, Brazil and Venezuela.
Mr Calderon promised a unity government and even offered Mr Lopez Obrador a cabinet post.