BRASILIA — Far-right lawmaker Jair Bolsonaro won Brazil's presidential election on Sunday, riding a wave of frustration over corruption and crime that brought a dramatic swing to the right in the world's fourth-largest democracy.

With 94 percent of ballots counted, Bolsonaro had 56 percent of the votes in the run-off election against left-wing hopeful Fernando Haddad of the Workers Party, abbreviated as PT, who had 44 percent, according to the electoral authority TSE.

"We cannot continue flirting with communism ... We are going to change the destiny of Brazil," Bolsonaro said in an acceptance address in which he vowed to carry out his campaign promises to stamp out corruption after years of leftist rule.

Supporters of Jair Bolsonaro, a far-right lawmaker who was elected president of Brazil on Sunday, react after polls closed in Sao Paulo, Brazil. Nacho Doce / Reuters

The former army captain's rise has been propelled by rejection of the leftist PT that ran Brazil for 13 of the last 15 years and was ousted two years ago in the midst of a deep recession and political graft scandal.

Thousands of Bolsonaro supporters cheered and set off fireworks outside his home in Rio de Janeiro's Barra de Tijuca beachfront neighborhood as his victory was announced. In Brazil's commercial capital of Sao Paulo, Bolsonaro's win was greeted with fireworks and the honking of car horns.

"Brazil is partying. Brazil's good people are celebrating," said Carmen Flores, local president of Bolsonaro's PSL party.

The vote had been calm and orderly across the country, said Laura Chinchilla, the former president of Costa Rica who is head of the Organization of American States' Electoral Observation Mission. Brazil has suffered a spate of partisan violence during the polarized campaign.

Many Brazilians are concerned that Bolsonaro, an admirer of Brazil's 1964-1985 military dictatorship and a defender of its use of torture on leftist opponents, will trample on human rights, curtail civil liberties and muzzle freedom of speech.

The 63-year-old seven-term congressman has vowed to crack down on crime in Brazil's cities and farm belt by granting police more autonomy to shoot at criminals. He also wants to let more Brazilians buy weapons to fight crime.