By Will Ross
BBC News, Accra
As soon as the chair of Ghana's Electoral Commission, Dr Kwadwo Afari-Gyan, had announced the final result a few parties began.
People danced outside the EC office with party flags, sounded car horns, pulled wheelies on mopeds and one man charged up and down the road on horseback.
It was third time lucky for Professor John Atta Mills who had stood against John Kufuor in 2000 and 2004.
After eight years of the New Patriotic Party in power, a wind of change has blown across Ghana just strong enough to push the opposition candidate over the line.
From around nine million valid ballots cast the governing party's candidate, Nana Akufo-Addo, lost by just 40,000 votes.
Outside the National Democratic Congress office in Accra a carnival was underway.
Some of the people were covered in white powder - a sign of victory in Ghana - and they danced to some of Professor Mills' campaign songs and the popular hit by DJ Blakk Rasta "Barack Obama" sent the crowd into a frenzy.
The man who is to be sworn in on 7 January hopes that the political party flags will be put away in preference for the red, gold and green national flag.
"The elections are overů. There is no NDC Ghana. There is no NPP Ghana. There is no CPP Ghana. There is one Ghana," he said to cheers.
There may have originally been eight candidates to succeed President Kufuor but this was always a two-horse race between parties which have a fierce rivalry and a history of bad blood.
Professor Mills may have a difficult task reigning in some of his party's hardliners but from his speech it sounds like he wants to build a few bridges.
"I want to congratulate all of them especially honourable Nana Akufo-Addo for giving us a good fight. It is my hope that we will be able to work together to build a better Ghana for us all," he said before the started blaring and the dancing crowd was sprayed with champagne.
Judging from the mood outside the NPP's office on Friday, not all party supporters were keen for Mr Akufo-Addo to throw in the towel and it would not have taken much for some young hot-heads to cause the kind of chaos that has marred closely-fought elections elsewhere on the continent.
Both parties had complained of vote rigging and intimidation during this election. The NPP had been counting on some of those complaints leading to a reduction in the Mills' tally.
But the Electoral Commission did not seem keen to become not just the referee, but also the police, judge and jury.
"Some of the issues raised border on criminality and therefore fall outside the competence of the electoral commission.
"In the purely electoral matters the commission did not find the evidence provided (by NPP) sufficient to invalidate the results," said Mr Afari-Gyan.
Nana Akufo-Addo and his party still want the allegations of intimidation and violence in the opposition stronghold of Volta Region examined.
"I've congratulated Professor Mills but it has been necessary for me to reiterate the concerns that we had about the conduct of the election," Mr Akufo-Addo said in a BBC interview.
"We owe it to Ghanaian democracy. We owe it to our people. At the end of the day what is it all about? You are looking for a verdict that reflects the true will of our people.
"Therefore if there are parts of that verdict that are questionable I think it is important that those concerns are allayed," said Nana Akufo Addo adding that court action was being considered.
For many Ghanaians there is huge relief that the election is finally over and there was no need to call on Kofi Annan to draw on his Kenyan mediation experience and pull the two sides apart.
Slightly more than half of Ghana's voters called for change. Now John Atta Mills has the tough task of delivering. The population has a long wish-list.