No sooner was Jair Bolsonaro sworn in as president of Brazil on New Year’s Day than he let loose a fountain of far-right decrees, undermining protections for the environment, indigenous land rights and the L.G.B.T. community, putting nongovernmental organizations under government monitoring and purging government contractors who do not share his ideology. This thrilled Donald Trump, who tweeted enthusiastically, “Congratulations to President @JairBolsonaro who just made a great inauguration speech — the U.S.A. is with you!”

Mr. Bolsonaro returned the love, tweeting back, “Together, under God’s protection, we shall bring prosperity and progress to our people!”

His actions were a sad but not unexpected performance by Brazil’s new leader, a onetime military officer whose 27 years in the Brazilian Congress were notable only for crude insults to women, sexual minorities and blacks. “A good criminal is a dead criminal,” he declared; he promised to send “red outlaws” to prison or exile; he dedicated his vote to impeach former president Dilma Rousseff to the military officer responsible for her torture under the former military dictatorship.

None of that seemed to matter to voters laboring under an economic collapse, a crime wave and a corruption scandal that undermined any faith in the political establishment. Mr. Bolsonaro’s promise of change, any change, was enough to sweep him into office with 55 percent of the vote in October. The language of his inaugural address — “I come before the nation today, a day in which the people have rid themselves of socialism, the inversion of values, statism and political correctness” — was music to the ears of his reactionary base, investors and Mr. Trump, who shares his values and his bluster. The stock market soared to record highs and the Brazilian real strengthened against the dollar.