Ghana's President Nana Akufo-Addo has won a second term after a tightly contested presidential election, the country's electoral commission announced Wednesday, beating long-time opponent John Mahama.

The results from Monday's vote came hours after police said five people had been killed in election-related violence, casting a shadow over a country hailed for its stable democracy.

Ghana
Reuters

Akufo-Addo of the centre-right New Patriotic Party (NPP) received 6,730,413 or 51.59 percent of votes while Mahama of the centre-left National Democratic Congress (NDC) received 6,214,889 or 47.36 percent, the electoral commission's chairperson Jean Adukwei Mensa said.

Observers viewed polling as generally free and fair but the political climate soured late Tuesday when Mahama accused his rival of showing "credentials that are very undemocratic".

Ghana has recorded high levels of growth during President Akufo-Addo's first term in office
Ghana has recorded high levels of growth during President Akufo-Addo's first term in office AFP / PIUS UTOMI EKPEI

Mahama accused Akufo-Addo of harnessing 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," the 62-year-old former president said.

Ghana has had seven peaceful transitions of power since the return of democracy more than 30 years ago, as post-electoral grievances have always been pursued through the courts -- a rarity in the troubled region.

John Mahama was president for four years until 2016
John Mahama was president for four years until 2016 AFP / PIUS UTOMI EKPEI

The European Union's chief observer, Javier Nart, told a press conference on Wednesday that "Ghanaians voted freely".

"While there were isolated violent incidents, both on election day and during the campaign... fears of violence and vigilantism fortunately didn't materialise: they were minor, isolated incidents, some of them tragic ones."

Ghana security forces were deployed to the electoral commission's head office in Accra before the results were announced
Ghana security forces were deployed to the electoral commission's head office in Accra before the results were announced AFP / Nipah Dennis

Despite the coronavirus pandemic, turnout was high on Monday, with 13,434,574 people voting -- 79 percent of registered voters.

Akufo-Addo and Mahama on Friday signed a symbolic peace pact, while the 15-nation regional bloc ECOWAS urged "all political parties and their leadership to respect."

Mahama and Akufo-Addo, 76, are old rivals who have faced off at the ballot box twice before.

Mahama was president for four years until 2016, before being succeeded by Akufo-Addo. Both of those elections were determined by small margins.

Ghana has recorded high levels of growth during Akufo-Addo's first term in office as he worked to diversify an economy largely dependent on cocoa exports and more recently oil and gold.

But while Ghana has made giant strides, many still live in extreme poverty with scarce access to clean water or electricity.

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.

A first and urgent task for the next government will be to limit mounting debt and control rising inflation.