Sao Paulo, Brazil (CNN) Far-right congressman Jair Bolsonaro pulled off a thumping win in the first round of Brazil's presidential election following one of the most polarizing campaigns since the country returned to democracy three decades ago.

Bolsonaro won Sunday's poll with 46% of the vote, ahead of left-wing ex-Sao Paulo mayor Fernando Haddad on 29%, according to tweets from the Supreme Electoral Tribunal's official Twitter account.

Bolsonaro's lead, in a field of 13 candidates, left him just short of the 50% needed to win outright and unable to avoid a runoff against Haddad, from the Workers' Party, on October 28.

"We indeed are able to change the destiny of Brazil," Bolsonaro said to media after learning he would face a runoff. "We cannot continue flirting with socialism or communism."

A victory in the second round for former army captain Bolsonaro would signal a historic shift to the right in Brazil. The Social Liberty party candidate has stirred controversy by making misogynistic, racist and homophobic remarks and has often been compared to US President Donald Trump and the Philippines' Rodrigo Duterte.

Read More