The Brazilian Senate has approved a controversial amendment to the constitution capping public spending for the next 20 years.
The approval of the austerity measure is an important victory for President Michel Temer.
He took office earlier this year promising to lead the country out of its worst recession in many decades.
Protests against the measure turned violent in the capital Brasilia and at least a dozen states in the country.
The opposition says the measures will mainly hit areas such as health and education, which are already underfunded.
Thousands of demonstrators took to the streets during the Senate session to protest against the austerity plan.
After the vote, many demonstrations descended into violence.
In Brasilia, masked protesters set fire to a bus and marched on the local offices of Globo TV, which they say is biased towards Mr Temer’s government. But the marchers were blocked by riot police.
In Sao Paulo, the headquarters of the state’s conservative Industrial Federation (Fiesp) was attacked.
To pass the constitutional amendment, the government needed the votes of 49 senators – three-fifths of the Senate.
The measure was approved by a narrower margin than the government expected, passing by 53 to 19 votes.
“We have won. That was the main thing: to deliver the product in the middle of a storm,” said government leader in the Senate Romero Juca.
The project, known in Brazil as PEC 55, freezes expenditure in the executive, judiciary and legislative branches of power, allowing them to grow only by the rate of inflation n the previous year.
The government argues it is necessary to boost growth and investments, and contain the country’s growing public deficit.
But critics say the poorest in society will be harmed and that setting a spending cap for two decades in advance is unrealistic, says the BBC’s Julia Carneiro in Rio de Janeiro.
The measure takes effect on Thursday.
Join GhanaStar.com to receive daily email alerts of breaking news in Ghana. GhanaStar.com is your source for all Ghana News. Get the latest Ghana news, breaking news, sports, politics, entertainment and more about Ghana, Africa and beyond.