Ghana's presidential election has been won by incumbent President John Mahama, the electoral commission has announced.
The commission said that Mr Mahama had won 50.7% against opposition leader Nana Akufo-Addo on 47.74%.
However, the opposition NPP says it will contest the result, accused the governing NDC party of conspiring with commission staff to fix Friday's poll.
President Mahama urged "all leaders of all political parties to respect the voice of the people".
"The voice of the people is the voice of God," he added.
Police in the capital Accra fired tear gas to disperse opposition protesters from outside the commission's offices.
Tanks guarded the electoral commission and roads around the offices were barricaded by police as the results were announced.
"Ladies and gentlemen, based on the results given, I declare John Dramani Mahama president-elect," electoral commission chief Kwadwo Afari-Gyan told journalists.
He said turnout had been about 80%.
Ghana, one of the world's fastest growing economies, is regarded as one of Africa's most stable democracies.
In a draft statement emailed to reporters on Sunday, the opposition said it would contest the results.
"This situation, if allowed to go unchallenged and uncorrected, would seriously damage the essence of the electoral process and the substance of democracy in Ghana," the NPP said.
"To accept this result is to discredit democracy in Ghana and, in the process, distort the process of democratisation in Africa. Therefore, the New Patriotic Party cannot accept the results of the presidential election as declared by the EC (election commission) this evening."
Earlier, the NPP said it had "enough concrete evidence" to prove that Mr Akufo-Addo had won the election.
"The ruling NDC conspired with certain EC staff in constituencies across the country to falsify the election results and thereby abuse the mandate of the people of Ghana," the party said.
"It was this planned, systematic stealing of votes at the collation level that was, thankfully, discovered in time."
The party cited discrepancies between initial tally sheets and the results reported in the media.
Mr Mahama's presidential adviser Tony Aidoo said there was no foundation for the allegations.
Mr Akufo-Addo lost the 2008 presidential poll by one percentage point, but accepted the result.
Glitches with a new finger-printing system meant that voting continued into Saturday in some parts of the country.
However, observers said the election had passed off largely peacefully.
Mr Mahama was Ghana's vice-president until the unexpected death of President John Atta Mills in July catapulted him into office.