Ghana's Supreme Court on Thursday rejected an opposition challenge to the December 7 presidential elections, saying allegations of fraud lacked evidence.
John Mahama, a 62-year-old former president, demanded a re-run after official results gave him 47.36 percent of the vote, against 51.59 percent for his rival Nana Akufo-Addo.
He accused the electoral commission of inflating the vote tally in favour of the 76-year-old incumbent.
"(The) allegation of vote padding was not proved by credible evidence... we have therefore no reason to order for a re-run," Chief Justice Kwesi Anin Yeboah said.
"We accordingly dismiss the petition as having no merit."
Mahama was expected to address supporters of his party later on Thursday.
Parliamentary elections were also held on December 7, resulting in a vote split down the middle, with the two main parties winning 137 seats each.
A lone independent won the remaining seat.
Election-related violence claimed five lives, and some of the political rhetoric, in a country which stands out as a stable democracy in volatile West Africa, has been white-hot.
On January 6, mayhem broke out in parliament after a lawmaker from the ruling party tried to seize the assembly's ballot box during the vote for speaker.
The ensuing clash lasted several hours until the army moved in, with national television broadcasting the drama live.
Mahama, in the election's immediate aftermath, accused Akufo-Addo of abuse of power, saying the armed forces "featured heavily as an intimidating measure" to skew the outcome.
It is not uncommon for election results to be contested in Ghana, where Akudo-Addo and Mahama were running against each other for the third time.
In 2012, it was Akufo-Addo who contested the victory of Mahama. After eight months of deliberations, the Supreme Court rejected his claim and upheld Mahama's win.
Ghanaian and foreign observers viewed the polling as generally free and fair, and Akufo-Addo has called on the opposition to turn the page.
"The Ghanaian people through the results have made it loud and clear that the two parties, the NPP and NDC, must work together especially in parliament, for the good of the country," he said after the results were announced.
Analysts have warned of the risk of legislative deadlock at a time when Ghana is desperate to rebound from the economic impact from the coronavirus epidemic.
The nation of 30 million was expected to see growth fall in 2020 to its lowest in three decades, to 0.9 percent, according to the International Monetary Fund (IMF), after 6.5 percent in 2019.
The government also faces the task of reining in debt, which has exceeded 70 percent of GDP, and control rising inflation.