The Brazilian Senate has approved a controversial labour reform bill – the first major overhaul in 70 years.
The law aims to reduce costs for businesses and allow firms to negotiate contracts freely with employees.
It was deeply unpopular with unions, who say it will reduce job security and called two general strikes in protest.
The vote is expected to give President Michel Temer a boost before Congress’ lower house decides if he should be suspended to face corruption charges.
The bill will now be sent to President Temer to be signed into law.
The main focus of the bill was on giving more leeway to collective bargaining and reducing the scope for legal action in labour disputes.
Under the labour bill, union dues – currently mandatory – will become voluntary. It also gives more flexibility for part-time work and temporary contracts.
Businesses have welcomed the changes, which they say will make the job market more flexible.
The unions argue they will lead to a reduction in job security in Latin America’s biggest economy.
Analysis: Good news at last for President Temer
Katy Watson, BBC South America correspondent, Rio de Janeiro
In a week when once again, President Michel Temer’s future is hanging in the balance, this is a rare bit of good news.
But it wasn’t a smooth ride in the Senate on Tuesday – with a six-hour sit-in by opposition politicians, the vote looked shaky at some points.
The expectation was that it would pass, and it did.
While the senators were arguing about Brazil’s economic future with the labour laws, lawmakers in the lower house this week started to debate Brazil’s political future – should President Temer be made to stand trial on charges of corruption?
Every day the odds on the president’s survival change. This vote result will boost his chances of staying in the job temporarily – but for how long, is anyone’s guess.
The legislation is part of a raft of business-friendly reforms proposed by President Temer, which include auctions for oil licensing rights, and transport concessions.
The most contentious proposal is to overhaul the social security system.
Analysts say the passing of the labour bill is a victory for Mr Temer, who was charged last month with taking bribes, which he has repeatedly denied.
The lower house of Congress must now vote on whether to allow the Supreme Court to try him.