Leftist Luis Inacio Lula da Silva on Sunday defeated President Jair Bolsonaro in an election runoff that marked a stunning comeback for Lula and the end of Brazil's most right-wing government in decades.
Lula won 50.9% of votes compared with 49.1% for Bolsonaro, the Supreme Electoral Court said, declaring former president Lula the winner. The 77-year-old Lula's inauguration is scheduled for Jan 1.
The vote was a rebuke for the fiery far-right populism of Bolsonaro, who emerged from the back benches of Congress to forge a novel conservative coalition but lost support as Brazil ran up one of the worst death tolls of the Covid-19 pandemic.
Bolsonaro, 67, who for years has made baseless claims that Brazil's voting system is prone to fraud, remained silent initially about the result. Electoral authorities are bracing for him to dispute the outcome, sources told Reuters, and made security preparations in case his supporters stage protests.
"Democracy," Lula wrote on Twitter, above a photo of the Brazilian flag beneath his left hand, missing his little finger, the result of an accident he suffered as a metalworker decades ago.
He was greeted by ecstatic supporters at a rally on Sao Paulo's Paulista Avenue ahead of a planned speech. Vice president-elect Geraldo Alckmin and campaign aides jumped up and down chanting, "It's time Jair, it's time to leave already," in a video circulating on social media.
Foreign leaders from US President Joe Biden to France's Emmanuel Macron to Argentina's Alberto Fernandez offered Lula messages of congratulations.
Lula has vowed a return to state-driven economic growth and social policies that helped lift millions out of poverty when he was previously president from 2003 to 2010. He also promises to combat destruction of the Amazon rainforest, now at a 15-year high, and make Brazil a leader in global climate talks.
His victory consolidates a new "pink tide" in Latin America, after landmark leftist victories in Colombia and Chile's elections, echoing a regional political shift two decades ago that introduced Lula to the world stage.
A former union leader born into poverty, Lula organised strikes against Brazil's military government in the 1970s. His two-term presidency was marked by a commodity-driven economic boom and he left office with record popularity.
However, his Workers Party was later tarred by a deep recession and a record-breaking corruption scandal that jailed him for 19 months on bribery convictions, which were overturned by the Supreme Court last year.
In his third term, Lula will confront a sluggish economy, tighter budget constraints and a more hostile legislature. Bolsonaro's allies form the largest bloc in Congress after this month's general election revealed the enduring strength of his conservative coalition.
Bolsonaro has repeatedly made baseless claims of electoral fraud and last year openly discussed refusing to accept the results of the vote.