Leftist candidate Gabriel Boric has won Chile's presidential election to become the country's youngest ever leader.
In what was expected to be a tight race, the 35-year-old former student protest leader defeated his far-right rival José Antonio Kast by 10 points.
Mr Boric told supporters he would look after democracy, promising curbs on Chile's neoliberal free market economy.
He will lead a country that has been rocked in recent years by mass protests against inequality and corruption.
Mr Boric's victory prompted celebrations on the streets of the capital Santiago, with his supporters waving flags and honking car horns.
In his speech, Mr Boric said he was taking on the job with humility and a "tremendous sense of responsibility", vowing to "firmly fight against the privileges of a few".
Official results gave Mr Boric 56% of the votes against Mr Kast's 44%. Mr Kast conceded defeat barely an hour-and-a-half after polls closed, and with around half of ballots counted.
Both candidates offered starkly different visions for the country, and both are outsiders representing political parties that have never been in government.
Once the most stable economy in Latin America, Chile has one of the world's largest income gaps, with 1% of the population owning 25% of the country's wealth, according to the United Nations.
Mr Boric has promised to address this inequality by expanding social rights and reforming Chile's pension and healthcare systems, as well as reducing the work week from 45 to 40 hours, and boosting green investment.
The president-elect also promised to block a controversial proposed mining project which he said would destroy communities and the national environment.
Chile's currency, the peso, plunged to a record low against the US dollar after Mr Boric's victory. Stock markets fell by 10%, with mining stocks performing particularly badly.
Investors are worried stability and profits will suffer as a result of higher taxes and tighter government regulation of business.
A new era but huge challenges remain
Gabriel Boric's speech was one of inclusion, emphasising that everyone would be a protagonist in his government. And he said he would be a president for all, even those who had not voted for him. He knows that Congress is split and he has his political opponents, but he welcomed it as a chance for dialogue.
This vote was deeply polarised, making Chileans decide between a man who praised the country's dictatorship and a protest leader who, his opponents said, would bring disorder and instability.
But in the end Chileans voted for a new era. And a new kind of president.
For many this result was a natural conclusion of the past few years. Protests exploded in 2019 with a rise in transport costs and, a year later, Chileans voted to rip-up the dictatorship-era constitution, and write a newer, more inclusive one.
Now a new leader has come out of all of this. But one of Gabriel Boric's biggest challenges will be to unite the millions of Chileans who voted for the other side.
'I have a lot of faith and hope'
Supporters responded to the victory with uncontained joy.
"I'm very excited because this is an achievement of the people," Andres Rodriques told Reuters news agency. "There have been many years of abuse and we need a renovation within politics. I have a lot of faith and hope in the youth."
Patricia Alarcon said she was really happy. "I always had faith in Boric because I think our country deserved this - we deserved freedom, integration - we deserved this result," she said.
A former student protest leader, Mr Boric backed the mass demonstrations against inequality and alleged corruption that rocked Chile in 2019 and 2020.
His rival, meanwhile, stood on a platform of law and order, pledging cuts to tax and social spending. Mr Kast also defended the legacy of Gen Pinochet, who took power in a coup and ruled the country from 1973 to 1990. Under his leadership more than 3,000 people were murdered by the state or disappeared.
In a tweet, Mr Kast said he had called Mr Boric to congratulate him on his "great triumph", adding: "From today he is the elected President of Chile and deserves all our respect and constructive collaboration".
The country is going through huge changes after voting overwhelmingly last year to re-write Chile's Pinochet-era constitution.
Outgoing President Sebastián Piñera said Chile was living in "an environment of excessive polarisation, confrontation [and] disputes," and urged his successor to "be the president of all Chileans".