Mr Calderon of the governing National Action Party (PAN) had 35.
88 percent and a lead of 236,006 votes, or 0.57 percent over Andres Manuel Lopez Obrador of the leftist Party of the Democratic Revolution (PRD) who had 35.31 percent.
Roberto Madrazo, whose Institutional Revolutionary Party controlled Mexico for 71 years until 2000, had 22.27 percent, and two minor candidates split the rest.
Mr Calderon was already reaching out to other parties to build a “unity government,” while his rival blamed fraud for his narrow loss in the vote count and called on his supporters to fill Mexico City’s main square in a show of force on Saturday.
Claiming the electoral process was marred by irregularities, Mr Lopez Obrador announced he will contest the outcome of the July 2 election in court and request a manual recount of the ballots.
“We have taken the decision to challenge the electoral process,” Mr Lopez Obrador said. “We have triumphed and this is what we will demonstrate to the tribunal.”
Mr Calderon insisted the votes had been counted and verified and that there was no need for a recount.
A preliminary count conducted immediately after the election gave Mr Calderon a 0.6-point advantage over his leftist rival, and the recount of tallies of ballots sent in by the 130,500 polling stations, on Thursday confirmed the narrow lead.
“Now is the time for conciliation,” Mr Calderon said after the results were posted by the Federal Electoral Institute.
Tribunal to make final deciison
The FEI will now hand over to the electoral tribunal, the final arbiter of electoral disputes. The tribunal must validate the outcome by September 6.
The confirmation of the president-elect had been a mere formality in the two previous presidential elections held since the tribunal was created, but Mexicans may now be kept on tenterhooks for weeks, if not months.
Washington had kept a close eye on the electoral nail-biter, evidently hoping to see a reversal of the trend that brought several leftists to power in Latin America over recent years.
A pro-business conservative, Mr Calderon had capitalised on fears that a Lopez Obrador victory would plunge Mexico into an economic crisis.
Mr Calderon likened his opponent to Venezuela’s virulently anti-US President Hugo Chavez, a comparison analysts generally dismiss.
Mr Calderon, 43, has served as energy minister in the cabinet of President Vicente Fox, whose 2000 victory ended 71 years of authoritarian rule by the Institutional Revolutionary Party (PRI).
During his campaign, he portrayed himself as the candidate for economic stability and employment.
But Mr Lopez Obrador, a former Mexico City mayor who champions the cause of the downtrodden, claims Mr Calderon represents a government that served the wealthy to the detriment of millions of impoverished Mexicans.
The PAN will become the main congressional party after winning about 34 percent of the seats in both the House and the Senate on July 2, but will not have an outright majority.
A free-trade advocate, Mr Calderon has vowed to complete fiscal reforms as well as labour and energy projects that were stymied during the Fox government for want of congressional support.
He has said he would seek congressional alliances to ensure the projects can be realised.
He has also vowed to crack down on rising crime and says he’ll try to smooth US relations without letting Washington dominate.
“I want to establish a very constructive relationship without bowing my head and lowering my eyes to the Americans,” Mr Calderon told the Associated Press.
“I have met with President Bush several times. I have interviewed with President Bush and several members of the American Congress, and I know it’s possible to establish a more constructive relationship, and that would be very good for both countries.”
The new president will take office on December 1 for a six-year term.