Inernational and local poll observers had criticised the election saying that their had been large-scale fraud.
But the court said opposition candidates Muhammadu Buhari, a former military leader, and Atiku Abubakar, a former-vice president, failed to provide enough evidence to prove that the April 2007 vote was too flawed to be credible.
A lower court had made a similar ruling earlier this year.
The election was the first handover of power from one civilian leader to another in Africa's most populous nation since Nigeria gained independence from Britain in 1960.
After decades of dictatorship and military rule, the government returned to civilian rule in 1999.
With the legal challenges now out of the way, Yar'Adua is now likely to face increased pressure to fulfil his campaign promises.
Yar'Adua pledged to address the country's decrepit energy sector as well as the violence afflicting the oil-rich Niger delta region.
Nigeria has largely been unaffected by the global financial crisis, but plummeting oil prices have slowed the country's growth in recent months. Around 80 percent of government revenues come from the sector.
Despite having the continent's largest oil industry, most Nigerians live in abject poverty.
Critics say Yar'Adua has moved too slowly on reforms, pointing out long delays in drafting the government's 2009 budget and choosing a new cabinet.