His leftist rival, Andres Manuel Lopez Obrador, had said he won't recognize the ruling. His supporters wept as the decision was announced and the courthouse shook as protesters set off fireworks outside.
"Felipe Calderon didn't win. Fraud won," said Francisca Ojeda, screaming to be heard over protesters throwing trash at the court and screaming "Fraud! Fraud!"
The court found no evidence of systematic fraud, although it threw out some polling place results for mathematical errors and other problems that trimmed Calderon's 240,000-vote advantage to 233,831 votes out of 41.6 million cast.
"There are no perfect elections," said Judge Alfonsina Berta Navarro Hidalgo.
Calderon was staying out of sight at the ruling party's offices and planned to give a nationwide address Tuesday night. His first tasks: winning over millions of Mexicans angry that President Vicente Fox didn't make good on promises of sweeping change while fending off thousands of radicalized leftists who say they will stop at nothing to undermine his presidency.