Congratulations poured in from across the globe for Brazil's leftist president-elect Luiz Inácio Lula da Silva after his narrow victory over far-right incumbent Jair Bolsonaro was announced.
Shortly after Lula was declared the winner, US President Joe Biden said: "I send my congratulations to Luiz Inácio Lula da Silva on his election to be the next president of Brazil following free, fair, and credible elections."
French leader Emmanuel Macron also offered his good wishes, saying the poll opened "a new page" in Brazil's history.
"Together, we will join forces to take up the many common challenges and renew the ties of friendship between our two countries," the French president said minutes after the results announcement.
Canadian Prime Minister Justin Trudeau offered a hearty "Congratulations, Lula!" and said: "The people of Brazil have spoken."
Trudeau said he looked forward to working with Lula, who served as Brazil's president from 2003 to 2010, to "advance shared priorities – like protecting the environment."
All eyes in Western capitals have been on the election's impact on the future of the Amazon rainforest and the global climate emergency.
President Alberto Fernández of Argentina said Lula's win "opens a new era for the history of Latin America. A time of hope and future that begins today."
"After so many injustices you lived through, the people of Brazil have elected you and democracy has triumphed," he added in a tweet.
After leaving office, Lula was imprisoned for 18 months on controversial and since-quashed corruption charges.
The former president's return to power in Brazil follows a string of left-wing wins in Latin America.
Gustavo Petro, who became Colombia's first leftist president after his election this summer, tweeted "Long live Lula."
He later shared a map showing that the majority of Latin American countries are now led by leftist governments.
Mexico's President Andrés Manuel López Obrador, also from the left wing, tweeted: "Lula won, blessed people of Brazil. There will be equality and humanism."
And Venezuelan President Nicolás Maduro offered a "big hug" to Lula, saying in a tweet: "Long live the peoples determined to be free, sovereign and independent! Today in Brazil democracy triumphed."
Fellow members of the BRICS group of emerging economies also extended their congratulations.
Russian President Vladimir Putin said he hoped for "constructive" cooperation.
"Please accept my sincere congratulations... the election results have confirmed your impressive political authority," Putin said in a telegram to Lula.
Chinese leader Xi Jinping wished the country "new successes."
"I am willing to work with President-elect Lula to make joint plans from a strategic height and long-term perspective, and take the China-Brazil comprehensive strategic partnership to a new level," he said.
Indian Prime Minister Narendra Modi said he looked forward "to working closely together to further deepen and widen our bilateral relations."
South African President Cyril Ramaphosa also said his country "looks forward to working with the government of Brazil under the leadership of Mr da Silva."
The European Union's chief diplomat Josep Borrell joined the international chorus: "Brazilian citizens went to the polls to elect their new president in a peaceful and well-organised election."
Borrell was followed by other European well-wishers, including Spanish Prime Minister Pedro Sánchez and German Foreign Minister Annalena Baerbock.
"Congratulations Lula on your victory... Let's work together for social justice, equality and against climate change," Sánchez tweeted.
Baerbock said Brazil's democracy was "the biggest winner", after the closely fought election.
"Another big winner is the world's climate," she said.
Britain's Prime Minister Rishi Sunak said he looked forward to working together on issues, including "growing the global economy to protecting the planet's natural resources and promoting democratic values."