Now the election campaigns must start again
Ghana's presidential election must be decided in a second-round vote, the electoral commission has announced.
Governing party candidate Nana Akufo-Addo won 49.13% of the vote, against 47.92% for his rival, John Atta Mills, the commission said.
But neither reached the 50% threshold needed for an outright win and a run-off will be held on 28 December.
Local and international observers have praised Ghana for setting a good example on how to conduct an election.
Electoral commission chairman Kwadwo Afari Gyan told a news conference in the capital, Accra: "There is going to be a re-run and it will be between the two leading candidates."
NPP candidate Mr Akufo-Addo won 4,159,439 votes, while NDC contender John Atta Mills had 4,056,634 ballots, it was announced.
There were eight candidates in total to succeed President John Kufuor - who steps down in January having served the maximum two terms - but the election has been a two-horse race.
Trailing a very distant third was businessman Papa Kwesi Nduom, of the Convention People's Party (CPP), with 1.3% of the ballot.
But correspondents have said the real third place went to spoiled ballots - out of the 8.6m votes cast, more than 200,000, or 2.4% of the total, were rejected.
The commission chairman did not immediately announce the results of the parallel parliamentary elections also held on Sunday, saying the commission needed to clarify some issues.
GHANA POLL IN NUMBERS
Eight candidates ran to succeed President John Kufuor
Ruling NPP party's Nana Akufo-Addo first with 49%
Opposition NDC's John Atta Mills second with 48%
Neither reaches 50% needed for outright win; run-off on 28 Dec
Turnout 70%; 8.6m votes cast; more than 200,000 rejected
Fifth elections since advent of multi-party democracy in 1992
"There are some disputes and claims," he was quoted by Reuters news agency as saying.
In the last parliament the governing New Patriotic Party (NPP) had a clear majority, but partial official results showed the opposition National Democratic Congress (NDC) closing the gap.
Turnout was 69.52% for Ghana's nail-biting fifth set of elections since it embraced multi-party democracy in 1992.
The BBC's Will Ross in Accra says after winning praise for its peaceful poll Ghana will now have to do it again, but the stakes are high, he adds, as the country has just discovered oil.
Some Ghanaians had hoped this election would already have been completed, fearing the run-off will be bad for business, he says.
"It doesn't look too good for Christmas for us," jewellery maker Irene Abba Amu told the BBC.
"It's been so quiet. Everybody's saying: 'Oh we are waiting until after the elections,' and now we've got to wait another three weeks."
But our reporter says while some businesses suffer, others will gain.
As the presidential aspirants hit the road in search of votes the printing presses will be churning out more posters and the street sellers will once again be stocking up with the scarves and T-shirts and other political paraphernalia.
Analysts say the Ghana polls so far have shown African states can hold credible ballots, after violence and claims of fraud this year overshadowed elections in Kenya, Zimbabwe and Nigeria.
The ex-British colony and nation of 22 million people was the first African state to gain its independence in 1957.
Regarded by investors as one of Africa's most promising emerging markets, it is the world's second biggest cocoa grower and Africa's number two gold miner.