Jair Bolsonaro (left) and Fernando Haddad are expected to contest a run-off.
The far-right candidate, Jair Bolsonaro, has won the first round of Brazil's presidential election.
He will face the left-wing Workers' Party candidate, Fernando Haddad, in the second round on 28 October after he failed to win the 50% of valid votes needed to win outright.
With almost all the votes counted, Mr Bolsonaro had 47% and Mr Haddad 28%.
Opinion polls conducted before the election predicted that in a second round the two candidates would be tied.
Jair Bolsonaro expected to win the presidency in this first round, even if the polls said otherwise. "On the 28th October, we can all go to the beach," he said, as he turned up to vote on Sunday. His supporters had been saying for weeks that their candidate would win this straight out.
Mr Bolsonaro may have soared in the polls recently but Brazilians are going to have to wait another three weeks to find out whether it'll be him or Fernando Haddad as Brazil's new leader.
Brazil feels very divided - and fragile. You could feel it when you talked to voters. So many people have told me they would be voting for the 'least worst' candidate. On one side, those determined never to allow the Workers' Party to rule again. On the other, those desperately trying not to allow a far-right candidate to rule this young democracy.