Early results in Brazil's presidential election suggest the far-right candidate, Jair Bolsonaro, will win the first round.
However, he looks set to fall just short of the 50% of valid votes needed to win outright.
If he does not reach the 50%, he will face Fernando Haddad from the left-wing Workers' Party in the second round on 28 October.
With 79% of the votes counted, Mr Bolsonaro has 48% and Mr Haddad 27%.
Opinion polls conducted ahead of the election had given Mr Bolsonaro a wide lead over Mr Haddad and the early exit polls are consistent with that.
The same polls predicted that in a second round the two candidates would be neck and neck.
In the days before the election, Mr Bolsonaro and his supporters had said they thought he could clinch victory in the first round.
"We are on an upward trajectory and are confident that the Brazilian people want to distance themselves from socialism," the 63-year-old former army captain had said.
But if these early exit polls are confirmed, Brazilians will have to choose between two very different candidates on 28 October.
At the scene: South America correspondent Katy Watson
The votes are still being counted but it looks like Brazilians are going to have to wait for another three weeks before they know who their next leader will be.
These elections have shown just how divided Brazil has become. Those on the right are determined not to let the Workers' Party, once led by former President Lula, rule once again.
Those on the left are desperate not to vote in a man who they feel is a threat to the country's young democracy. But Mr Bolsonaro – a politician who wants to get tough on crime with looser gun laws and has talked fondly of military rule – has lots of support.
Mr Bolsonaro missed the final part of the electoral campaign after he was stabbed by a lone attacker but saw his popularity rise in recent weeks.
Divisive and eventful
A Catholic who has won the support of many evangelical Christians, Mr Bolsonaro quoted the Bible as he cast his vote. "Our banner was always John 8:32: 'Then you will know the truth, and the truth will set you free'," he said.
Mr Bolsonaro has stirred controversy with racist, homophobic and misogynist comments and there have been mass demonstrations against him.
But his tough stance on crime has won him the support of many Brazilians who feel that record-high crime rates have made them prisoners in their own homes.
On the eve of Sunday's vote, Mr Bolsonaro said his government would hand down the tough punishments offenders deserved. He is in favour of relaxing gun ownership laws and has spoken of torture as a legitimate practice. He also wants to restore the death penalty.
A former mayor of São Paulo, Mr Haddad is backed by former President Luiz Inácio Lula da Silva, who was disqualified from standing in the election after he was jailed for corruption.
Mr Haddad has portrayed himself as a trusted candidate for those who balk at Mr Bolsonaro's style and rhetoric. "I don't believe in violence, in military dictatorship or the lack of liberty," he tweeted.
"I'm very hopeful that we will have a much more civilised second round," Mr Haddad said about the deep divisions the campaign had stirred up
"We have the ability to defeat what Bolsonaro stands for, in terms of reversing social gains, in terms of civility, in terms of solidarity and in terms of mutual respect," he said.
People have also been casting ballots to elect all Brazil's state governors as well as two-thirds of the senators and all lawmakers in the chamber of deputies.
More than 1,000 seats in state legislatures across the country are also being contested.