A far-right former army captain has won the first round of Brazil's presidential election, and will face a second-round runoff against a leftist rival later this month.

Jair Bolsonaro, 63, won 46 per cent of the vote compared to 29 per cent who turned out for former Sao Paulo Mayor Fernando Haddad.

Bolsonaro needed to get more than 50 per cent of the vote to avoid a second round of votes, which will now be held on October 28.

Polls had predicted that Mr Bolsonaro would come out in front, but he far outperformed expectations, despite having made shocking statements on refugees and minorities in the past.

Bolsonaro has called refugees 'the scum of the earth', said he would 'whack' gay men if he saw them kissing and that he would rather his child died than be homosexual.

He also once branded a female opponent 'too ugly to deserve to be raped', and has said black Brazilian descendants of African slaves were 'of no use even to procreate'.

First round down: Brazil's right-wing presidential candidate for the Social Liberal Party (PSL) Jair Bolsonaro won the first round of the general elections held on Sunday

Far-right surge: Supporters of Bolsonaro celebrate as the results came in in Brasilia, Brazil

Another Bolsonaro voter cheers on a street in Rio de Janeiro as the far-right candidate won 46 per cent of the vote

Supporters of Brazilian presidential candidate Jair Bolsonaro celebrate outside his home in Rio de Janeiro

Despite winning the first round, Bolsonaro charged that 'polling problems' had cheated him of outright victory in the first round.

Some of his supporters protested outside the national electoral tribunal in the capital Brasilia, chanting 'Fraud!'

That anger reflected the uncertain outlook for the second round.

Surveys suggest Bolsonaro will have the edge, but that Haddad will draw nearly even with him after picking up substantial support from the defeated candidates.

'We expected to win in the first round,' one Bolsonaro voter, 77-year-old retiree Lourdes Azevedo, said bitterly in Rio de Janeiro.

The other side: Workers Party candidate Fernando Haddad, pictured on Sunday, won 29 per cent of the vote and will be the second name on the ballot on October 28

Naked truth: Bolsonaro supporters are seen celebrating in the street wearing t-shirts with the candidate's face on wrapped around their waists

Supporters of Jair Bolsonaro and his Social Liberal Party celebrate in front of his house in Rio de Janeiro, Brazil

People watch Brazilian presidential candidate for the Worky Party (PT) Fernando Haddad's press conference on TV at a bar of Lapa neighborhood, in Rio de Janeiro

'Now things are more difficult: the second round is a risk.'

Haddad, addressing his own supporters, called the looming run-off 'a golden opportunity,' and challenged Bolsonaro to a debate.

He replaced popular former president Luiz Inacio Lula da Silva in the race after Lula, imprisoned for corruption, was disqualified.

JAIR BOLSONARO: THE FAR-RIGHT EX-ARMY CAPTAIN'S PLATFORM The 63-year-old former paratrooper has vowed a harsh crackdown on rampant crime. Despite sitting in congress for nearly three decades, Bolsonaro casts himself as a political outsider in the mold of America's Donald Trump or the Philippines' Rodrigo Duterte: tough talking, brash, promising a root-and-branch overhaul to an electorate weary of traditional parties spouting empty promises. Better-off Brazilians have rallied to Bolsonaro's pledge to crush crime that includes more than 62,000 murders each year, nearly as many rapes and frequent robberies. Bolsonaro wants to boost police forces and relax gun laws for 'good' citizens. Many voters also like his promises to tackle corruption and cut climbing public debt through privatisations, as well as the devout Catholic's family-first stance. But he faced fierce resistance from a big part of the 147-million strong electorate put off by his denigrating comments against women, gays and the poor, and his unabashed nostalgia for the brutal military dictatorship that ruled Brazil between 1964 and 1985. Advertisement

Despite his complaints, Bolsonaro did not formally contest Sunday's result, saying his voters 'remain mobilized' for the second round.

But he faces fierce resistance going forward from a big part of Brazil's 147-million-strong electorate put off by his record of denigrating comments against women, gays and the poor.

His unabashed nostalgia for the brutal military dictatorship that ruled Brazil between 1964 and 1985 has also sent a chill through many voters.

Haddad, though, has his own burden.

As the Workers' Party candidate, he faces the palpable disappointment and anger of voters who blame the party for Brazil's worst-ever recession, and for a long string of graft scandals.

Sunday's general election - in which new federal and state legislatures were also chosen - exposed the deep divisions generated by both candidates.

Some voters - particularly women - carried 'Not Him' placards to polling stations in opposition to Bolsonaro.

But his supporters, like 53-year-old lawyer Roseli Milhomem in Brasilia, said they backed the veteran lawmaker because 'Brazil wants change.'

'We've had enough of corruption. Our country is wealthy - it can't fall into the wrong hands,' she said.

Political analyst Fernando Meireles of Minas Gerais Federal University said momentum appeared to favor Bolsonaro.

'The probability of Bolsonaro coming out victorious seems pretty big right now,' Meireles told AFP.

Supporters of Jair Bolsonaro, the far-right presidential candidate of the Social Liberal Party (PSL), on the streets of Rio de Janeiro on Sunday night

Supporters of Jair Bolsonaro gather at Paulista Avenue waiting for the results of the vote count, in Sao Paulo

Left-wing supporters react during the vote count at a bar in Sao Salvador Square in the South Zone of Rio de Janeiro

Supporters of Brazilian presidential candidate Fernando Haddad, celebrate the result

JAIR BOLSONARO'S MOST CONTROVERSIAL QUOTES Right-wing ex-army captain and presidential front-runner Jair Bolsonaro is a controversial figure in Brazil, not least for a series of comments about torture, rape, homosexuals and women. Here are some of the 63-year-old's most eye-catching comments. REFUGEES 'The scum of the earth is showing up on Brazil, as if we didn't have enough problems of our own to sort out.' September 2015. TORTURE 'I'm in favour of torture.' May 1999. 'During the dictatorship, they should have shot 30,000 corrupt people, starting with the (then) President Fernando Henrique Cardoso, which would have been a great gain for the nation.' - Guotes carried by TV Bandeirantes, May 1999. 'The dictatorship's mistake was to torture but not kill.' - Interview with Jovem Pan radio station, June 2016. 'For the memory of colonel Carlos Alberto Brilhante Ustra, the terror of Rousseff... my vote is yes!' - After voting in favor of impeaching then-president Dilma Rousseff, a former guerrilla who was tortured under the military dictatorship, Bolsonaro dedicated his vote to retired colonel Ustra, the former head of the military dictatorship's intelligence services accused of having killed at least six people under torture. KILLING 'We're going to shoot the PT supporters in Acre.' - During a Workers' Party (PT) electoral meeting in the western state on September 1. His communications department subsequently said: 'it was a joke, as always.' RELIGION 'God above all. This history of a secular state doesn't exist, no. The state is Christian and those who are against it can leave. The minority must bow to the majority.' - A meeting in Paraiba, February 2017. RACE 'I went to a quilombola (a settlement of African slave descendants) in Eldorado Paulista. The lightest Afro-descendent weighed seven arrobas (around 80 kilograms, 225 pounds). They don't do anything. They're no use even to procreate.' - During a conference at Rio de Janeiro's Hebrew Club following a visit to a quilombola. 'Preta, I'm not going to talk about promiscuity with anyone. I won't run that risk, because my sons were brought up very well and they haven't lived in environments such as is, unfortunately, yours.' - When singer and presenter Preta Gil, the daughter of renowned musician Gilberto Gil, asked him on TV Bandeirantes in March 2011 how he would react if one of his sons fell in love with a black woman. Later, Bolsonaro said he'd misheard the question and thought it referred to a possible homosexual relationship. WOMEN 'It saddens me to see the entrepreneurial world in Brazil, because it's a misfortune to be a boss in our country, with so many labor laws. Between a man and a young woman, what will the entrepreneur think? 'Damn, this woman's got a ring on her finger, she'll be pregnant soon, she'll be on maternity leave for six months...' Who's going to pay the bill? The employer. In the end it's deducted from social security but the work rhythm is broken. And when she returns, she'll take a month-long vacation. In the end, she works five months in one year.' - Interview with Zero Hora newspaper, December 2014. RAPE 'She doesn't deserve to be raped because she's very ugly. She's not my type, I'd never rape her. I'm not a rapist, but if I was, I wouldn't rape her because she doesn't deserve it.' - Bolsonaro speaking to Zero Hora in December 2014, explaining why he previously told leftist deputy, Maria do Rosario: 'I wouldn't rape you, you don't deserve it.' HOMOSEXUALS 'I wouldn't be able to love a gay son. I wouldn't be a hypocrite, I'd prefer a son to die in an accident than appear with a moustacho.' - Interview with Playboy magazine, June 2011. 'I won't fight it or discriminate, but if I see two men kissing each other in the street, I'll whack them.' October 2002. 'I don't run the risk [of seeing my children date black women or be gay]. My childrem were very well raised.' March 2011. Advertisement

'It looks difficult for Haddad to win in the second round, but not impossible.'

Better-off Brazilians have rallied to Bolsonaro's pledge to crush crime in a country where there are more than 62,000 murders each year, nearly as many rapes, and frequent muggings and robberies.

Bolsonaro wants to boost police forces and relax gun laws for 'good' citizens.

Many voters also like his promises to tackle corruption and to cut climbing public debt through privatizations, as well as the devout Catholic's family-first stance.

But poorer Brazilians, who benefited the most from the heyday during Lula's time in office from 2003 to 2010, want a return to good times and hope Haddad can deliver.

The result is a very split electorate. Whoever ultimately wins the presidency in the world's eighth largest economy will grapple with a large bloc of ideological hostility.

Despite sitting in congress for nearly three decades, Bolsonaro casts himself as a political outsider in the mold of America's Donald Trump or the Philippines' Rodrigo Duterte: tough-talking, brash, and promising a root-and-branch overhaul to an electorate weary of traditional parties spouting empty promises.

People burn a cardboard box depicting an electronic ballot box, in Sao Paulo on Sunday night