Former president Luiz Inacio Lula da Silva has defeated incumbent Jair Bolsonaro in an election that marked a remarkable comeback for the leftist leader and the end of the country's most right-wing government in decades.
Lula had 50.8 percent of votes compared with 49.2 percent for Bolsonaro with 99.1 percent of voting machines counted, which the Supreme Electoral Court said was enough to "mathematically define" the outcome of the race.
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.
Lula has vowed a return to state-driven economic growth and social policies that helped lift millions out of poverty when he governed Brazil 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 saw him jailed 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.
The election served as a referendum on two starkly different - and vehemently opposed - visions for Brazil's future.
Bolsonaro vowed to consolidate a sharp rightward turn in Brazilian politics after a presidency that witnessed one of the world's deadliest outbreaks of Covid-19 in the pandemic and widespread deforestation in the Amazon basin.
Lula promises more social and environmental responsibility, recalling the rising prosperity of his 2003-2010 presidency, before corruption scandals tarnished his Workers Party.
Bolsonaro has without proof described the voting system as fraud-prone, raising concern he may not concede defeat, following the example of his ideological ally, former US president Donald Trump.
That has added to tensions in Brazil's most polarising election since its return to democracy in 1985 after a military dictatorship that Lula, a former union leader, rallied against and Bolsonaro, a former army captain, invokes with nostalgia.
Lula allies on Sunday said police had stopped buses carrying voters on highways even though the electoral authority had prohibited them from doing so. Brazilian media reported that such operations were concentrated in the northeast, where Lula has the strongest support.
"What happened today is criminal. There is no justification for the [police] to mount roadblocks on Election Day," Workers Party President Gleisi Hoffman told journalists.
However, the Superior Electoral Court (TSE), which runs Brazil's elections, said no one had been prevented from voting and declined to extend voting hours. The federal highway police said they had complied with court orders.
With Bolsonaro stickers on her chest, Rio de Janeiro resident Ana Maria Vieira said she was certain to vote for the president, and would never countenance picking Lula.
"I saw what Lula and his criminal gang did to this country," she said, as she arrived to vote in Rio's Copacabana neighbourhood, adding that she thought Bolsonaro's handling of the economy had been "fantastic."
A Lula victory marked a stunning comeback for the leftist leader, who was jailed in 2018 for 19 months on bribery convictions that the Supreme Court overturned last year, clearing the way for him to seek a third presidential term.
In Sao Paulo, 31-year-old lawyer Gerardo Maiar said he was horrified by what Bolsonaro had done as president.
"The last four years were an embarrassment, both nationally and internationally," he said after voting. "I think it's ridiculous for Brazil to be in this shameful position."
Voting was electronic and the results were announced within two hours of polling stations closing. Lula is expected to take office on 1 January.
- Reuters