His opponent, leftist candidate Fernando Haddad, said he would fight to 'defend the freedoms of those 45 million people' who voted for him.
Rio De Janeiro: Former army captain Jair Bolsonaro was elected president of Brazil on Sunday, promising a fundamental change in direction for the giant Latin American country, the latest to take a turn to the far-right.
Despite repulsing many with his open support of the torture used by Brazil's former military regime, as well as remarks deemed misogynist, racist and homophobic, Bolsonaro managed to tap voters' deep anger with corruption, crime and economic malaise.
Official results gave the controversial president-elect 55.13 percent of the vote in the run-off election, to 44.87 for leftist opponent Fernando Haddad, with 99.99 percent of the ballots counted.
Bolsonaro, 63, will take office on January 1.
"We will change Brazil's destiny together," he said in his victory speech -- broadcast live from his home on Facebook, the platform he has used to campaign since an attacker stabbed him in the stomach at a rally on September 6.
Sitting next to his wife and wearing a dark blazer, the longtime congressman delivered his speech in a stern voice.
He pledged to govern "following the Bible and the constitution," and said: "We cannot continue flirting with socialism, communism, populism and the extremism of the left."
But he promised to defend "the constitution, democracy and freedom," fending off opponents' warnings he would try to veer toward authoritarianism after openly expressing his admiration for Brazil's brutal military dictatorship (1964-1985).
Thousands of supporters flooded the streets outside his home in Rio de Janeiro, waving Brazilian flags and lighting up the sky with fireworks.
"All these people here are outraged, upset about corruption and crime, and we are with Bolsonaro. The people have spoken. For the first time I feel represented," said Andre Luiz Lobo, 38, a businessman who -- not incidentally, given the accusations of racism against his candidate -- is black.
The White House said US President Donald Trump had called Bolsonaro to congratulate him.
Dubbed the "Tropical Trump" by some, Bolsonaro publicly admires the American leader.
Vow to fight
On the other side, the reaction was despair -- and a defiant vow to resist.
Haddad, a former Sao Paulo mayor, said he would fight to "defend the freedoms of those 45 million people" who voted for him, after Bolsonaro vowed late in the campaign to "cleanse" Brazil of leftist "reds."
Aides said Haddad, 55, had not called Bolsonaro to congratulate him.
"Fascists!" shouted tearful supporters at the headquarters of Haddad's Workers' Party in Sao Paulo.
"I'm surprised Brazilians would vote for hate, for guns," said Flavia Castelhanos, 31, after wiping away her tears, wearing a pin that said "Not him" -- opponents' rallying cry against Bolsonaro.
Political analysts and activists reacted in grim tones.
"This is a dark day for Brazil. Brazilian democracy is now in complete crisis," said Mark Weisbrot of the Center for Economic and Policy Research in Washington.
The environmental group Amazon Watch warned victory for Bolsonaro -- who has vowed not to let conservation programs interfere with agro-industry -- "spells disaster for the Brazilian Amazon."
Bolsonaro has offended many in Brazil and beyond with his vitriolic rhetoric.
He once told a lawmaker he opposed that she "wasn't worth raping;" he has said he would rather see his sons die than come out as gay; and he commented after visiting one black community that they "do nothing -- they're so useless I doubt they can procreate."
But an even larger portion of voters rejected Haddad and the tarnished legacy of the Workers' Party, which had won the past four presidential elections.
The polls came on the heels of Brazil's worst-ever recession, a staggering multi-billion-dollar corruption scandal and a year of record-setting violent crime.
Haddad stood as a surrogate for the popular -- but imprisoned -- ex-president Luiz Inacio Lula da Silva, who led Brazil through the boom years of 2003 to 2010, before both the country and his left-wing political project went bust.
The highly divisive Lula, who stands accused of masterminding the massive pilfering of state oil company Petrobras, was barred from running because he is serving a 12-year sentence for bribery.
Center-right President Michel Temer, who is set to leave office as the most unpopular leader in Brazil's modern democracy, congratulated Bolsonaro and said the transition process would start Monday.