Petro beat construction magnate Rodolfo Hernandez on Sunday with an unexpectedly wide margin of more than 700,000 votes in what analysts said was a demonstration of Colombians' eagerness for efforts to combat deep inequality.
Petro, a former mayor of capital Bogota and current senator, has pledged to fight inequality with free university education, pension reforms and high taxes on unproductive land.
He won 50.5 per cent to Hernandez's 47.3 per cent in the second round of voting.
Petro's proposals - especially a ban on new oil projects - have startled some investors, though he has promised to respect current contracts.
"From today Colombia changes. Colombia is different," Petro told cheering supporters in Bogota's concert arena.
"Change consists precisely in leaving behind sectarianism.
"It is not a time for hate, this government, which will begin on August 7, is a government of life."
Thousands of people took to the streets in Bogota to celebrate, with some dancing near its largest polling place under intermittent rain.
This campaign was Petro's third presidential bid and his victory adds the Andean nation to a list of Latin American countries that have elected progressives in recent years.
Petro's victory showed people in Colombia - where nearly half the population lives in some form of poverty - are eager to fight inequality, said Daniela Cuellar of FTI Consulting.
"What the Colombian population demonstrated today is that they are seeking a government focused on key social issues," she said.
"Colombia's longstanding ailments of inequality, which were exacerbated by COVID-19, have contributed to the electorate seeking a shift."
But a fragmented congress, where a dozen parties have seats, would act as a check on Petro's proposals, Cuellar said.
Petro, 62, said he was tortured by the military when he was detained for his involvement with the M-19 guerrilla movement, and his potential victory had high-ranking armed forces officials bracing for change.
Petro's running mate, Francia Marquez, a single mother and former housekeeper, will be the country's first Afro-Colombian woman vice-president.
Petro has also pledged to fully implement a 2016 peace deal with FARC rebels and seek talks with the still-active ELN guerrillas.
President Ivan Duque tweeted he had called to congratulate Petro, and they have scheduled a meeting in coming days to ensure a harmonious transition.
Colombian presidents are limited to one term.
Some 22.6 million people voted, about 1.2 million more than in the first round. Some 2.3 per cent of voters turned in protest votes, backing neither candidate.