Brazil's Senate approved on Tuesday a 20-year freeze on government spending billed as the centerpiece of austerity reforms aimed at restoring economic health to the troubled Latin American giant.
The upper house voted 53 to 16 to lock in the spending ceiling.
Center-right President Michel Temer says tough measures are needed to get Brazil's finances back under control, but his austerity policies have prompted violent protests and were criticised last week by a UN expert as "a historic mistake."
Police were out in force in the capital Brasilia to protect government buildings from demonstrators during the upper house vote, which was wrapped up unexpectedly quickly.
Luis Jorge, a union leader who had come for the protests, expressed anger at the Senate for voting "before we could demonstrate. That makes us very angry."
However, hundreds of people, many with their faces covered, clashed with police later Tuesday. Security forces fired tear gas to try to disperse the crowd.
A bus was burned during the demonstration, which drew about 2,000 people, police said. The police operation in the capital ended with 100 arrests, officials said.
In Sao Paulo, left-wing protesters attacked the headquarters of FIESP, the country's main industrial association, before being driven back.
The vote means that the spending cap is now mandated by the constitution, serving as the central plank in Temer's bid to "transform" the broken economy, which is in deep recession.
However, Temer is rapidly losing political clout as he and many of his senior allies fight to survive a slew of corruption allegations.
Brazilians battered by nearly 12 per cent unemployment and stubbornly high inflation are increasingly angry over the scandals and hostile to the austerity measures.
A poll published Tuesday showed that 60 per cent of Brazilians oppose the spending ceiling. Only 24 per cent are in favor, according to the Datafolha poll published in the newspaper Folha.
When the Senate held a first vote on the measure two weeks ago, protesters fought riot police outside Congress, burning cars and smashing windows.
'We need courage'
Temer, in an attempt to claw back public support, has unveiled stimulus measures that would attempt to give a short-term boost to the ailing economy, the largest in Latin America.
But as the Senate began debating he defended his far-reaching austerity proposals, saying they were needed to change Brazil for the long term.
In addition to the spending ceiling, a separate measure is being submitted to Congress proposing pension reforms. At the center of the measure would be a minimum retirement age of 65, substantially higher than the current requirement, which varies widely between professions, but can be as early as 55 years old.
"We need a lot of courage at this moment in Brazil to do things that are apparently unpopular but which will bring popularity later," he said in a statement.
"We need to transform the country," he said.
Philip Alston, the UN poverty and human rights rapporteur, attacked the 20-year spending cap as "putting an entire generation at risk of social protection standards well below those currently in place."
"This is a radical measure, lacking in all nuance and compassion," he said last week. "It will hit the poorest and most vulnerable Brazilians the hardest."
However, there was a boost from the incoming US president, Donald Trump, who "congratulated" Temer for the reforms in a phone conversation Tuesday, according to the Brazilian presidency.
Temer's entire government is struggling in the face of allegations tying senior figures and the president himself to the giant embezzlement and bribery probe centered on state oil company Petrobras.
Temer came to power last August after the impeachment of leftist president Dilma Rousseff. As her former vice president, Temer was appointed to the post automatically for the rest of her term through 2018.
Temer said he would focus on ending the political and economic chaos that had doomed the Rousseff government.
However, the latest poll from Datafolha shows 63 per cent of Brazilians want him to resign to allow early elections. Only 10 per cent said they thought his government is doing a good job.