"The election commission... declares Mr Ashraf Ghani, who has won 50.64 per cent of the votes, as the president of Afghanistan," election commission chief Hawa Alam Nuristani told a press conference in Kabul.
"May God help him in serving the people of Afghanistan... I also pray that peace comes to our country," she added.
The results had been delayed for nearly five months after allegations of vote-rigging from Ghani's main rival, Afghanistan's Chief Executive Abdullah Abdullah, forced a recount.
Afghanistan — dealing with the deal
The delay left Afghanistan facing a political crisis just as the US seeks a deal with the Taliban which would allow it to withdraw troops in return for various security guarantees and a promise that the militants would hold peace talks with the Afghan government.
If all goes well, then Ghani is likely to be the man sitting across from the Taliban at the negotiating table in a bid to chart Afghanistan's future.
Earlier this week, Abdullah's team said they would not accept fraudulent results.
Current vice-president Abdul Rashid Dostum, a powerful Uzbek former warlord and Abdullah's ally, has also threatened to form a parallel government if fraudulent election results are announced.
Trump’s tumbling Afghanistan strategy
Abdullah lost to Ghani in 2014 in a divisive election that saw the US intervene to broker an awkward power-sharing deal between the two rivals.
Nearly one million of the initial 2.7 million votes were purged owing to irregularities, meaning the election saw by far the lowest turnout of any Afghan poll.
Ultimately, only 1.8 million votes were counted -- a tiny number given Afghanistan's estimated population of 35 million and 9.6 million registered voters.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ