Luiz Inácio Lula da Silva, who prevailed in the first round of the Brazilian presidential election, will meet incumbent Jair Bolsonaro in the second round.
Former president Lula, a leftist, received 47.97% of the vote, while Bolsonaro, a rightist, received 43.60%, the electoral office reported on Sunday.
Since no candidate received more than 50% of the vote, a runoff election will be held on October 30 between Lula and Bolsonaro, the two leading competitors.
Considering how far ahead Lula was in the pre-election polls, the outcome was much closer than anticipated.
Some observers hypothesised that voters had not chosen their actual favourites or made up their minds on election day.
Lula would be the first democratically elected president of Brazil to serve a third term if he wins the second round.
He was previously president from 2003-2010.
Many of Lula’s supporters associate the 76-year-old with Brazil’s golden age, when the economy boomed due to high commodity prices and the government used social programmes to lift millions out of abject poverty.
His opponents see him as responsible for corruption and cronyism.
Bolsonaro’s supporters meanwhile see the incumbent as a defender of traditional family values and economic freedom.
Lula has accused Bolsonaro of genocide because of his hesitant coronavirus policy, while Bolsonaro calls Lula a thief as the former president was convicted for corruption and spent time in prison.
The election has left Latin America’s largest economy extremely divided.
At least three Lula supporters have been killed by suspected Bolsonaro supporters in recent months.
The incumbent’s supporters have repeatedly openly called for a military coup.
During his four years in office, Bolsonaro has largely isolated the Latin American country internationally, rejecting proposals to protect the rainforest and hardly ever travelling abroad.
Brazil’s election has great significance for the rest of the world as the winner will shape the country’s environmental policies.
As a huge carbon sink, the Amazon plays an important role in the fight against global climate change.
Lula campaigned on environmental and climate policies and pledged to end illegal gold mining and fight against deforestation.
More than 156 million people were eligible to vote in Sunday’s presidential election and voting is compulsory. Lawmakers, senators and governors were also being elected on the same day.