Brazil's presidential race will go to a second round after the far-right candidate, Flávio Bolsonaro, beat the incumbent leftwing president, Luiz Inácio Lula da Silva, but failed to secure the outright majority he needed to avoid a runoff. This was reported by Qazaqyia.kz citing The Guardian.

With more than 98% of votes counted, the 45-year-old son of the disgraced former president, Jair Bolsonaro, had won 47.3%, meaning he will now face a 25 October showdown with his 80-year-old rival. Lula received 44.8%.

Bolsonaro will go into the second round as favourite and is likely to be boosted by the migration of votes from the election's other rightwing candidates, who included Ronaldo Caiado, who secured 2.2%, and Renan Santos, who won 2.2%.

Brazil's far-right put in a stronger than expected showing, with a succession of Bolsonarista politicians winning congressional or gubernatorial races. They included Jair Bolsonaro's second son, Carlos Bolsonaro, and his wife, Michelle Bolsonaro, who both won seats in the senate. Bolsonaro's youngest son, Jair Renan, was elected to the lower house of congress. Bolsonaro's former infrastructure minister, Tarcísio de Freitas, was reelected as governor of São Paulo, Brazil's most populous and economically important state.

On Sunday morning, as Lula cast his vote in São Bernardo do Campo, the industrial hub in the São Paulo metropolitan area where he began his political career more than half a century ago, the former union leader said Latin America's largest democracy faced a stark choice.

"People are going to have to choose between strengthening democracy and barbarism," Lula told reporters, highlighting his adversary's well-documented links to members of Rio's underworld, including once employing close relatives of a notorious contract killer.

After voting in Rio, where the Bolsonaro political dynasty was born in the late 80s, Flávio Bolsonaro urged Brazilians to end what he called Lula's "era of backwardness". "I'm more than ready to lead this country and to give Brazilian families the right to dream once again," claimed Bolsonaro, who has promised an iron-fisted crackdown on crime, despite his ties to members of Rio's paramilitary mafias.

Lula, who became Brazil's first elected working-class president in 2002 and was returned to office in 2006 and 2022, is hoping to secure a historic fourth non-consecutive term in this year's election.

Allies of the veteran leftwinger call the election a crucial battle in the fight against a far-right movement that less than four years ago brought chaos to the capital, Brasília, during an unsuccessful attempt to overturn the result of the 2022 election, when Lula beat the incumbent president, Jair Bolsonaro.

"Brazilian democracy is at stake," said Talíria Petrone, a leftwing congresswoman from Rio who is seeking reelection.

Speaking at Lula's final pre-vote rally in Rio, Petrone called for tactical voting to prevent the Bolsonaro clan returning to power. "I'm sure that even those people who don't like Lula know that Flávio Bolsonaro must be defeated – and the only way is a fourth presidential term for president Lula," Petrone said.

Bolsonaro hopes winning the presidency will allow him to free his father, who is serving a 27-year sentence for plotting a failed coup after refusing to accept he had lost the last election to Lula. Ahead of the election he also called for tactical voting from conservatives who are not supporters of Bolsonarismo, but want to vote Lula out of power.

As well as the president, Brazil's nearly 159 million voters are choosing state parliamentarians, 27 state governors, 513 members of the lower house and 54 members of the 81-seat senate.

Speaking on the eve of the election, Maria Tereza Fazzio, 74, a retired psychologist from Rio, said she had voted for Lula ever since he first ran for the presidency in 1989 – four years after the end of Brazil's 21-year dictatorship. She vowed to do so again this year, in order to protect social programmes implemented by Lula and out of fear that a Bolsonaro victory could put her country's democracy in jeopardy.

"All he talks about is granting an amnesty to his dad and all the others who are in prison [because of the 2022-23 coup attempt] – he hasn't got any policy agenda," she said of Bolsonaro.

Bolsonaro seemed to have the wind in his sails in the final days before Sunday's vote, amid public frustration at a cost of living crisis and urban violence.

However, his momentum appeared to have been interrupted by a row involving Brazil's Catholic patron saint, Our Lady of Aparecida. Speculation that Bolsonaro – who is part of Brazil's fast-growing evangelical community – might strip the widely cherished patroness of her position caused a nationwide outcry, leaving some to question if it could tip the knife-edge election in favour of Lula, who is Catholic.

On Sunday, an influential Catholic bishops' organisation, the Episcopal Conference of Brazil, posted a thinly veiled swipe at Bolsonaro on social media. "May God grant us wisdom and courage to build together a reconciled, sovereign, just, and fraternal Brazil," the group wrote on X, calling on Our Lady of Aparecida.