RIO DE JANEIRO — Protests flared in cities around Brazil on Tuesday after the Senate approved a 20-year cap on federal spending, a cornerstone of President Michel Temer’s proposed austerity measures aimed at restoring confidence in the country’s ailing economy.

Evoking some of the fierce protests that have rattled the country in recent years, demonstrators attacked the iconic headquarters of the Federation of Industries in São Paulo, smashing the building’s windows before being dispersed by security guards.

Protests were reported in at least 15 cities, including in major urban centers like Rio de Janeiro, Salvador and Porto Alegre, and security forces arrested dozens of protesters in the capital, Brasília.

The protests reflect anger over the Senate vote, which could limit spending to the rate of inflation for as long as two decades, and Mr. Temer’s fledgling government, which is mired in graft scandals just months after the ouster of his predecessor, Dilma Rousseff.