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 46% and Mr Haddad 29%.
Opinion polls conducted before the election predicted that in a second round the two candidates would be tied.
What has Mr Bolsonaro said?
Mr Bolsonaro said that he was certain that if there had not been “problems” with the electronic voting system used in Brazil, he would have won outright.
“I am certain that if this hadn’t happened, we would have known the name of the president of the republic tonight,”
He did not specify what he thought those “problems” were.
Brazil’s electoral authorities have said the vote went ahead peacefully and without any major problems.
Why Mr Bolsonaro expected to spend 28 October on the beach
Katy Watson, BBC South America correspondent
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, there are 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.
There’s a feeling of nervousness that’s hanging over Brazil – and will do for the next few weeks as both candidates ramp up their campaigning once again. The future of Brazil will vary greatly, depending on who eventually wins.
The choice ahead
Brazilians will have to choose between two very different candidates on 28 October.
- Fernando Haddad: Betting on moderation
- Jair Bolsonaro: Trump of the Tropics?
Mr Bolsonaro, a Catholic, won the support of many evangelical Christians by saying he would defend traditional family values. He has also won over many Brazilians who think his law-and-order stance will make Brazil safer.
On the eve of Sunday’s vote, he said that is government would hand down the tough punishments offenders deserved. He is also in favour of relaxing gun ownership laws and has spoken of torture as a legitimate practice. He also wants to restore the death penalty.
In his victory speech, broadcast live on Facebook and uploaded onto Twitter, he said that were two paths Brazilians could follow.
“[There is] the path of prosperity, liberty. family, on God’s side… and the other one is that of Venezuela,” he said referring to Brazil’s socialist-led neighbour, a country mired in a deep economic and political crisis which has driven more than two million people to leave.
“We can’t take another step to the left!” he urged voters. “We can’t go fraternising with socialism or communism,” he said.
He acknowledged that a lot of criticism had been levelled against him but vowed to “unite the [Brazilian] people”.
“Together we will be a great nation,” he said.
How did Mr Haddad respond?
Mr Haddad has portrayed himself as a trusted candidate for those who baulk at Mr Bolsonaro’s style and rhetoric.
Speaking after he had made it into the second round, he said that he and the Workers’ Party would “only use arguments, we don’t use any guns”.
Referring to Mr Bolsonaro’s lead he said that he felt “challenged by the results, which alerts us to the risks Brazilian democracy is facing”.
“We need to approach this with a sense of responsibility. We want to unite the democrats of this country, to reduce inequality and to achieve social justice,” he told his cheering supporters.
He said he and his party have been presented with “a golden opportunity” by making it into the second