Luiz Inácio Lula da Silva has been re-elected president of Brazil, the electoral authority has said, in a result that defied poll predictions - but his opponent has refused to accept the result.
It comes after an incredibly tight election race between the leftist incumbent, known widely as Lula, and Flávio Bolsonaro, the right-wing son of a jailed former president.
Lula is a vocal critic of Donald Trump, and while the result is set to provide relief to critics of the US president, it is likely to be met with dismay in Washington after the latest polls up until Saturday put Bolsonaro slightly ahead.
Nearly two hours after the result was announced, Bolsonaro said it was impossible to accept the result and he would be asking for the election to be annulled.
The voting was neck and neck throughout the count that took place on Sunday evening, until just after midnight UK time when Lula appeared to have pulled ahead.
Lula's victory will mean the 80-year-old will serve an unprecedented fourth term.
With virtually 100% of the vote counted, Brazil's electoral court said Lula held an unassailable lead.
Its website said Lula got 51.79% of the votes, to Bolsonaro's 48.21%. 50% is required to win.
More than 33 million of the nearly 160 million registered voters did not vote.
A Supreme Court-mandated pause in vote counting late on Sunday injected confusion into the already tense run-off race.
Supreme Court Justice Cristiano Zanin, who was formerly Lula's lawyer, accepted a request by both campaigns to extend voting because of public transportation issues in major cities.
The decision was handed down three minutes before the 5pm cut-off time, creating confusion as some polling stations had already closed.
In a subsequent ruling, it was decided that polling stations that had not yet shut down their voting machines could continue receiving votes for an additional two hours.
Bolsonaro, 45, won the agricultural hub of the centre-west and the southern region, which borders Uruguay and Argentina.
He said afterwards that extending the voting hours was unacceptable.
But Lula overtook his challenger's gains by winning in the northeast and north, which includes the Amazon rainforest.
In the first round of the election earlier this month, Bolsonaro beat Lula by more than 2.2 million votes, before the two leading candidates went on to contest Sunday's run-off election.
More from Sky News:
Pro-Russian Serbian leader defeated
Ukraine, Russia and US talks to be held
A video published by his campaign showed Lula and his wife, first lady Rosângela da Silva, celebrating with a cake after the result was announced. Lula will turn 81 on Tuesday.
His triumph bucks a trend in Latin America where increasing numbers of right-of-centre presidential candidates allied with Mr Trump have been winning, further extending the US's influence in the region.
The victory means Brazil remains with Mexico in electing left-leaning leaders.
The result also positions Latin America's largest economy, with a GDP of $2.6trn per year, to remain independent of the US.
This breaking news story is being updated and more details will be published shortly.
Please refresh the page for the fullest version.
You can receive breaking news alerts on a smartphone or tablet via the Sky News app. You can also follow us on WhatsApp and subscribe to our YouTube channel to keep up with the latest news.
(c) Sky News 2026: Lula re-elected president in Brazil but his opponent Flavio Bolsonaro refuses to accept result
Serbia's pro-Russian former leader urges supporters to avoid 'killings' after defeat
Second person charged in connection with shooting of police officer in Nottingham
The Ukrainian veteran of the battle for Mariupol who lost 25kg as a Russian prisoner of war
Over 80 people injured after bus plunges 65ft down Spanish hillside
Power surge at major UK airport causes delays to hundreds of flights
Exiled Venezuelan opposition leader announces shock return to the country
Meeting between Ukraine, Russia and US to be held next month, Zelenskyy says
PM open to 'honest discussion' about return to free movement with EU
