Brazil’s presidential election is heading for a closely watched runoff after right-wing Senator Flávio Bolsonaro finished ahead of incumbent President Luiz Inácio Lula da Silva in the first round.

With almost all ballots counted, Bolsonaro secured 47.03% of valid votes, compared with 45.16% for Lula, according to Brazil’s Superior Electoral Court. Neither candidate crossed the 50% threshold required for an outright victory.

The two will now face each other in a second-round vote scheduled for October 25, setting up a major political showdown in Latin America’s largest economy.

Flávio Bolsonaro, 45, is the son of former President Jair Bolsonaro and is seeking the presidency for the first time. His first-round performance exceeded expectations after several pre-election surveys had suggested a much tighter race.

Speaking after the results, Bolsonaro said the outcome showed that “Brazil wants change” and described it as a potential end to the Workers’ Party era associated with Lula.

Lula, 80, acknowledged that he had expected to win in the first round but said the campaign was entering a new phase.

“Starting tomorrow, we’ll begin a new campaign,” the president said, while portraying Bolsonaro as an uncertain choice for Brazil.

The runoff is expected to focus heavily on the economy, crime, corruption, social programmes and Brazil’s relationship with the United States and China.