The commission said Ghani garnered 923,592 votes, or 50.64%, in the election that took place last Sept. 28. His main challenger, the country's chief executive Abdullah Abdullah received 720,841 votes, or 39.52%.
Ghani and Abdullah head a fragile national unity government that was put together under U.S. pressure after both leaders claimed victory in Afghanistan's last elections in 2014.
Election results were repeatedly delayed amid accusations of misconduct and technical problems with counting ballots. The final vote tally was originally to be announced Nov. 7.
Hawa Alam Nuristani, head of the election commission, said previously that 1.8 million Afghan citizens voted in the election out of some 9.6 million eligible voters.
On election day, many Afghans found incomplete voters' lists, unworkable biometric identification systems aimed at curbing fraud, and in some cases hostile election workers.
In Kabul, it was rare to see a crowded polling center. Afghans who had patiently lined up before voting centers were opened, in some locations found that election officials had yet to arrive by opening time.
The election commission tried to launch a ballot recount in November but Abdullah halted the attempt, saying he wouldn't let his observers participate. Thousands of his supporters rallied against what they said were fake ballots and the controversial recount had seemed set to favor Ghani.
Abdullah in December agreed, however, to allow a ballot recount in provinces where his supporters had stopped the process.
The government's push to hold the vote was in itself controversial. In an interview with The Associated Press before the election, former Afghan president Hamid Karzai warned the vote could be destabilizing for the country at a time of deep political uncertainty.
Tuesday's election results come days after U.S. Defense Secretary Mark Esper announced a truce agreement between the United States and the Taliban that could lead to the withdrawal of American troops from the country.
The agreement was expected to be formally announced Sunday and the reduction in violence would begin Monday, according to people familiar with the plan. That would be followed by all-Afghan peace talks that envision the phased withdrawal of U.S. forces over 18 months.
Ghani first ran for president in 2009, capturing barely a quarter of the votes. He ran again in 2014 in what was considered a deeply flawed and corrupt exercise.
Ghani, from central Logar province, was born May 19, 1949. He holds a doctorate in Anthropology from Columbia University and first went to the U.S. as a high school exchange student.
Except for a brief teaching stint at Kabul University in the early 1970s, Ghani lived in the United States, where he was an academic until joining the World Bank as a senior adviser in 1991.
Ghani returned to Afghanistan after 24 years when the Taliban were ousted by the U.S.-led coalition. He was head of Kabul University until he joined President Hamid Karzai's government as finance minister. In 2010 he led the lengthy process to transfer security of the country from U.S.-led coalition forces to the Afghanistan National Security Forces, which took effect in 2014.