Ghanaian President John Kufuor has secured a second four-year term, the election commission chairman says.
Kufour's team will now focus on fighting poverty
Mr Kufuor, known as the "gentle giant", won 52.75% of the vote in Tuesday's presidential poll, sparking street parties in the capital, Accra.
His main rival, opposition leader John Atta Mills, gained 44.32% of the vote.
Observers have praised the conduct of the election, which attracted a high turnout of 83.2%, however, the opposition has lodged complaints.
Results from five districts are still expected, but they will not change the overall outcome, Election Commission chairman Kwadwo Afari-Djan said.
"I declare President Kufuor new president of the Ghana republic," he said.
His New Patriotic Party has also gained a majority in parliament, with 129 out of 230 seats.
The BBC's Kwaku Sakyi-Addo in Accra says that thousands of people poured onto the streets to celebrate Mr Kufuor's re-election, wearing the red, white and blue colours of his party and shouting his name.
The president's press secretary Kwabena Agyepong told the BBC that he had expected a bigger margin of victory and he would use his second term to try and improve living standards for Ghana's poor.
"We need to work much harder to bring the fruits of economic progress to the people of Ghana," he said.
Mr Atta Mills' National Democratic Congress (NDC) has complained about the high number of spoilt and rejected ballot papers - 2% - and has alleged that in Mr Kufuor's stronghold of the central Ashanti region, the number of votes cast was higher than the number of registered voters.
However, the electoral commission has rejected both complaints.
Mr Kufuor defeated Mr Atta Mills four years ago, in an election that marked the country's first peaceful and democratic transfer of power since independence from Britain in 1957.
The presidential election is the fourth since Ghana became a multi-party state in 1992.
The two other presidential candidates got less than 2% of votes cast.
The election was praised for being calm and orderly
Edward Mahama, candidate of the Grand Coalition of opposition parties, including the People's National Convention (PNC) polled 1.9%.
George Aggudey, of the Convention People's Party (CPP) founded by Ghana's first leader Kwame Nkrumah, received 1%.
The BBC's Andrew Simmons in Accra says
Mr Kufuor's supporters voted for stability, even though daily costs such as school fees, petrol prices and consumer goods are making their lives difficult.
The president has drastically reduced inflation and borrowing costs, and assured people during the campaign that prices and wages would improve.
Mr Atta Mills focused on the major issue of poverty.
He assured poor people, who make up 40% of the country's 20 million population, that under his rule they would see more money in their pockets.
But the BBC's reporter says it appears that his tactics have failed to undermine Mr Kufuor's economic reforms.
The majority of people trust him, our reporter says, although in the longer term they will want to see some personal gain in return.