Ghana's President Nana Akufo-Addo narrowly beat his long-time rival John Mahama to win a second term, the electoral commission announced on Wednesday.
But Ghana's main opposition party has rejected the results of the presidential and legislative vote, citing alleged irregularities.
Akufo-Addo, 76, won by a slim margin securing 51.59% of the total votes cast, while opposition leader former President John Mahama secured 47.36%.
In his victory speech, Akufo-Addo called for unity.
"Now is the time, irrespective of political affiliations, to unite, join hands and stand shoulder to shoulder," he told his cheering supporters.
Local and international election monitors have said that the elections were transparent, free and fair.
But tensions rose on Monday after Mahama,62, claimed to have won a parliamentary majority and warned Akufo-Addo against stealing the vote.
Mahama alleged that Akufo-Addo had harnessed the military in a bid to sway the outcome, a claim the government said was false.
"You cannot use the military to try and overturn some of the results in constituencies that we have won. We will resist any attempts to subvert the sovereign will of the Ghanaian people," Mahama said.
'Prosperous and progressive Ghana'
The West African country is known as a bastion of stability and democracy in the region but police said five people were killed in election-related violence.
An urgent task for the next government will be to improve living standards and bolster growth, which has been hammered by the coronavirus pandemic.
"There could be a tendency for an incumbent, who has just secured a second term, to take it easy and relax," Akufo-Addo said.
"I am of a different character. I give you my word that I will continue to work very hard to build a prosperous and progressive Ghana, for which we yearn."
Despite the coronavirus pandemic, turnout was high, with over 13 million people voting (79 percent of registered voters).
Severely hit by the pandemic, growth in the nation of 30 million people is expected to fall this year to its lowest in three decades, to 0.9 percent according to the International Monetary Fund, a steep decline from 6.5 percent growth in 2019.
The full count of the 275 parliamentary seats has not been announced and is expected to be very close between Akufo-Addo's centre-right New Patriotic Party (NPP) and Mahama's National Democratic Congress (NDC) party.
Mogadishu residents welcome introduction of direct vote
Go to video
Libya: the beginning of rapprochement between rivals from the East and the West
Mauritania's ruling party wins majority seats in local and legislative polls
John Mahama wins Ghana's opposition presidential primaries
Ghana gives assurances to help secure $3 billion IMF loan.
Go to video
A Ghanaian painter and her blue girls take on forced marriage