This article was last updated at 21:00 GMT/UTC.
Polling stations around the country were scheduled to close at 5 p.m. local time (2000 GMT).
Some polling stations will most likely stay open slightly later.
First figures on the vote after polls closed varied wildly in a matter of minutes.
The first numbers published by the electoral commission put Lula at 51% support. This was soon reduced to 47%. And then a third update around 20 minutes after polls closed gave a slight lead to Bolsonaro instead, at 47.6% to Lula’s 41%.
The figures could continue to vacillate until a more meaningful share of the vote is counted.
Apart from the presidential showdown, Brazilian voters are also queuing up to elect the lower house of Congress, a third of the Senate, as well as governors and state legislators nationwide.
At the race for Congress’s 513 seats, as well as the 27 seats at the Senate, Bolsonaro’s conservative coalition is expected to win a majority.
If the pre-election polls prove accurate and Lula wins the presidential election, that could leave his leftist government struggling to implement policies without control of the legislature.
A man fired at two military personnel at a polling station in Sao Paulo during the elections on Sunday.
Military police in the city said in a statement on Twitter that the men were conscious and receiving medical attention. It added that the polling station remained in operation despite the incident.
Security was upped during the Sunday vote, with military forces mobilized at nearly 500,000 polling stations.
Bolsonaro’s term witnessed an uptick in arms ownership, as he eased gun control laws.
While casting his ballot, Lula said he hoped for a “country at peace.”
“We don’t want more hate, more discord,” he said.
A Brazilian head of court also wished for a “peaceful and safe” vote.
Supreme Court Justice Alexandre de Moraes, among Bolsonaro’s staunchest foes, said in a tweet that the electoral court was hard at work. Moraes heads the federal electoral court and has led investigations into Bolsonaro.
This came as Bolsonaro cast doubt on the results of Sunday’s vote, accusing the electoral authorities of conspiring against him and hinting at convening a military-supervised count in parallel.
Brazil’s armed forces had limited involvement in previous elections; their presence was merely more pronounced in more violent regions and during the transport of voting machines to isolated areas.
Authorities have set up some 477,000 polling stations around the country.
More than 156 million people are eligible to vote, using electronic voting machines that allow for the swift tabulation of results. The system has been in place in 1996.
The country’s election authority has reportedly acquired 224,900 new machines for this election, bringing the total number used Sunday to more than 577,000.
Bolsonaro has repeatedly alleged that the electronic voting system is plagued by fraud — without evidence. His comments are similar to former US President Donald Trump’s criticism around the 2020 US presidential election.
Following his criticism, the election regulator has invited a record number of foreign election observers, including first-time missions from US observers at the Carter Center and the International Foundation for Electoral Systems (IFES).
“If we have clean elections, we will win today with at least 60% of the votes,” Bolsonaro said in a video posted to social media as he cast his vote.
The far-right incumbent, who has repeatedly alleged Brazil’s electronic voting system is plagued by fraud — without evidence — did not directly answer journalists’ questions on whether he would respect the result if he loses.
He said he was confident he would win despite polls showing Lula with a double-digit lead.
“All the evidence we have is favorable to us. The other side has not been able to take to the streets, has not campaigned, has no acceptance, no credibility, Bolsonaro added.
Lula told supporters he is running for president “to get the country back to normal” after four years under far-right incumbent Jair Bolsonaro.
“We don’t want more hate, more discord. We want a country at peace,” said the 76-year-old ex-president after casting his vote.
“This country needs to recover the right to be happy,” he added.
Brazilians began casting ballots Sunday in a polarizing election pitting far-right President Jair Bolsonaro against leftist front-runner Luiz Inacio Lula da Silva.
Polling stations opened at 8 a.m. Brasilia time (1000 GMT) and will stay open until 5 p.m.
After a campaign that left the South American giant deeply divided, all eyes are on whether Lula, who was president from 2003 to 2010 can win in a single round, without going to a runoff on October 30.
There are also concerns over whether Bolsonaro, who has alleged fraud in Brazil’s electronic voting system, will accept the result.
There’s no proven history of significant electoral fraud since Brazil moved to electronic voting in 1996, whereas the old system was notoriously prone to manipulation.
mm, rmt/msh (AFP, AP, dpa, Reuters)