Gustavo Petro, the former mayor of Bogota and ex-rebel fighter, has become Colombia’s first left-wing president.
Mr Petro, a current senator, defeated the right-wing construction magnate Rodolfo Hernández in Sunday’s run-off election.
Figures show he took 50.5% of votes, defeating his millionaire rival by a close margin of around 700,000 ballots.
The result marks a major change for the country, which for decades has been led by moderates and conservatives.
The vote was held amid widespread discontent at the way the country has been run, and there were anti-government protests last year in which dozens of people died.
The 62-year-old Mr Petro hailed what he called a “victory for God and for the people”.
“May so much suffering be cushioned by the joy that today floods the heart of the homeland,” Mr Petro wrote on Twitter. “Today is the day of the streets and squares.”
His running mate Francia Marquez, a single mother and former housekeeper, will become the country’s first black woman vice-president.
In a video posted to social media, Mr Hernandez, who ran a non-traditional campaign that relied heavily on TikTok and other social media, conceded to Mr Petro.
“I accept the results of this election,” he said. “I hope that Mr Gustavo Petro knows how to run the country and is faithful to his discourse against corruption,” he added.
President Ivan Duque, who was barred from seeking re-election by Colombia’s term limits, said on Twitter that he had called Mr Petro to congratulate him. He added that they had “agreed to meet in the coming days to initiate a harmonious, institutional and transparent transition”.
Mr Petro was a member of the now disbanded M-19 movement in the 1980s. The rebel left-wing group was one of many guerrilla organisations that waged war against the state.
He spent time in jail for illegal arms possession, before joining the political opposition where he served as both a senator and congressman as well as mayor of Bogota.
Mr Petro ran on a radical manifesto and pledged during the campaign to fight inequality by providing free university education, pension reforms and high taxes on unproductive land.
He also pledged to fully implement a 2016 peace deal that ended a 50-year long conflict with the communist guerrilla group, Farc, and to seek negotiations with the still-active ELN rebels.