Ghana's President Nana Akufo-Addo has been re-elected after a tightly contested election on Monday.
Mr Akufo-Addo obtained 51.6% of the vote, compared with 47.4% won by his main rival, ex-President John Mahama, official results showed.
Mr Mahama has not yet conceded defeat. His party has rejected the results, citing alleged irregularities.
It was the third time the two politicians had faced each other in a presidential election.
Ghana has a reputation for being one of the most stable democracies in Africa.
Results in the parliamentary elections have yet to be announced, but are expected to be very close as well.
There are wild celebrations across the country after official results showed Mr Akufo-Addo had won a second term, reports the BBC's Thomas Naadi from the capital, Accra.
The president now faces the challenge of tackling high levels of unemployment and boosting the economy, which has been badly hit by the coronavirus pandemic, our reporter adds.
Earlier police said there had been 21 cases of election-related violence since Monday, leaving five people dead.
This is Ghana's eighth presidential election since its constitution was redrawn in 1992.
Mr Mahama was president for four years until 2017, when he was succeeded by President Akufo-Addo. Both contests were determined by small margins.
Due to the coronavirus pandemic, the country's usual political rallies were postponed during the race. Instead, President Akufo-Addo's centre-right New Patriotic Party and Mr Mahama's centre-left National Democratic Congress battled on social media, radio and television for much of the election season.
However, in the last days of campaigning, caution was thrown to the wind as politicians met crowds of voters. There is now concern that there could be a surge in coronavirus infections.
Ghana has reported more than 50,000 Covid-19 infections, with at least 300 people succumbing to the virus.