Liberian President George Weah has called his challenger in the presidential race, Joseph Boakai, to congratulate him on his victory.
In an address to the nation he said "the Liberian people have spoken and we have heard their voice".
The opposition candidate holds an unassailable lead of 28,000 votes with nearly all ballots counted.
A former football star, President Weah has been in power since 2018. He will step down in January.
He came into the job on a wave of enthusiasm, especially from younger voters, having won that election - also against Mr Boakai - by a large margin.
But a perception that he had failed to tackle corruption, rising prices and continued economic difficulties tarnished his image.
Mr Weah was magnanimous in defeat, beginning his five-minute address by saying he had "the utmost respect for the democratic process that has defined our nation", adding that he had spoken to Mr Boakai who he called the "president-elect".
Earlier the electoral commission announced that Mr Boakai, a 78-year-old political veteran had 50.89% of the votes, while President Weah had 49.11%.
The president referred to the closeness of the race saying it "reveals a deep division within our country" and called on Liberians to "work together to find common ground... unity is paramount for mama Liberia".
A long period of civil war in which an estimated 250,000 people died ended just 20 years ago.
When the latest set of results were announced earlier on Friday, they sparked celebrations in the capital, Monrovia.
Mr Boakai's supporters gathered at his party's headquarters in the city, convinced that he had won the election.
They called for President Weah to go, and chanted "we beat the Buga dancer" - referring to a song that became associated with his campaign.
The electoral commission says it has announced the results from 99.58% of the polling stations following Tuesday's run-off election.
The run-off between Mr Boakai and Mr Weah was triggered after neither candidate got more than 50% of the vote in last month's first round. There were 18 other candidates.
In that vote, the president got the largest share and was just 7,000 votes ahead of Mr Boakai.
The poll was the tightest presidential contest in Liberia since the civil war.
Mr Boakai's campaigning focused on the need to rescue the nation from what he called "mismanagement" by Mr Weah's administration.
The president dismissed Mr Boakai's allegations, saying he had made significant strides, including introducing free tuition for university students.
This is the fourth time a presidential election has taken place since the war ended.
Observers from the regional bloc, Ecowas, deemed the run-off largely peaceful, AFP news agency reports.
But there were isolated incidents that led to "injuries and hospitalisations" in the provinces of Lofa, Nimba, Bong and Montserrado, it quotes observers as saying.
ADDRESS TO THE NATION
BY
HIS EXCELLENCY DR. GEORGE MANNEH WEAH
PRESIDENT OF THE REPUBLIC OF LIBERIA
CONCERNING THE RESULTS OF THE RUN-OFF PRESIDENTIAL ELECTIONS HELD ON NOVEMBER 14, 2023
MONROVIA, LIBERIA
MY FELLOW LIBERIANS, DISTINGUISHED LADIES AND GENTLEMEN:
I stand before you tonight with a heavy heart, but with the utmost respect for the democratic process that has defined our nation. As your President and the leader of the Coalition for Democratic Change, I want to address you on the outcome of the run-off elections held on November 14, 2023.
The results announced tonight, though not final, indicate that Ambassador Joseph N. Boakai is in a lead that is insurmountable. A few moments ago, I spoke with President-elect Joseph N. Boakai to congratulate him on his victory and to offer my sincere commitment to working with him for the betterment of our beloved Liberia.
I extend my heartfelt congratulations to President-elect Boakai, his supporters, and his campaign team. May his presidency be marked by success for all Liberians, and may our nation prosper under his leadership.
Tonight, as we acknowledge the results, let us also recognize that the true winners of these elections are the people of Liberia. Through your peaceful and orderly exercise of your constitutional right to vote, you have once again demonstrated your commitment to the democratic principles that bind us together as a nation.
Under my leadership, these elections were organized with a promise to the Liberian people – a promise of fairness, transparency, and credibility. I am proud to say that, for the most part, we have fulfilled that promise. The Liberian people have spoken, and their choice will be honored and obeyed.
At this juncture, I would like to congratulate the National Elections Commission for a job well done. You have earned the respect of all Liberians, our foreign partners, international observers, and the world at large for completing this difficult task to the satisfaction of all stakeholders, including the contesting parties.
However, the closeness of the results reveals a deep division within our country. As we transition to the new Boakai administration, we must be vigilant to the dangers of division and work together to find common ground. Now, more than ever, unity is paramount for the love of Mama Liberia.
To the members of the Mighty Coalition for Democratic Change, fellow partisans, CDCians, Weahcians, auxiliaries, first-time voters, campaign managers, and party leaders, I understand that this is not the outcome we desired. Although we did not emerge victorious, your hard work and support have been the backbone of our campaign, and for that, I am deeply grateful.
I urge you to follow my example and accept the results of the elections. Go home tonight with the knowledge that our ideals and vision for Liberia remain strong. We are a young movement, and our time will come again. Tomorrow, resume your daily activities in a normal way, and come and join me at our party headquarters to reflect on our journey and plan for our return to political leadership in 2029.
MY FELLOW LIBERIANS, LADIES AND GENTLEMEN:
Tonight, the CDC has lost the election, but Liberia has won. This is a time for graciousness in defeat, a time to place our country above party, and patriotism above personal interest. I remain your President until the handover of power, and I will continue to work for the good of Liberia. Let us heal the divisions caused by the campaign and come together as One Nation and One United People.
May God bless Liberia, and may we continue to strive for a brighter future together.
Thank you, and good night.