The Senate has passed an unpopular overhaul of Brazil's labour laws, a move that was crucial for embattled President Michel Temer to show he has political support while trying to survive a damaging corruption accusation.
Opposition senators had tried to block the vote with a sit-in at the president's rostrum, but the session resumed after a six-hour delay and in a vote on the measure's initial reading the body voted 50-26 in favour.
The bill is part of a programme being pushed by Mr Temer that he says will get the economy going again.
Senators allied with the president did not take the opportunity to speak in favour of loosening work rules and other changes in the overhaul, which opinion polls indicate is widely unpopular with Brazilians.
"The Brazilian people know that this reform will not bring jobs," said Humberto Costa, leader of the opposition Worker's Party.
After a tense day, Senate president Eunicio Oliveira was able to resume the session from his chair in the early hours of the evening.
Insurgent senators commandeered the leaders' table on the rostrum early in the day and prevented Mr Oliveira and some of his allies from taking their seats.
Mr Oliveira responded by ordering the power and microphones cut off and he adjourned the session, leading to hours of negotiations behind the scenes while the insurgents remained in the chamber.
After six hours, Mr Oliveira took a seat at a smaller chair and restarted the session while having to shout to fellow senators, and the rebels soon gave up the sit-in.
The spectacle underscored how acrimonious Brazilian politics have become in recent months as Mr Temer's popularity has plummeted and a corruption charge against him has emboldened members of the opposition who believe he never should have become president.
Mr Temer took power last year after his predecessor, Dilma Rousseff, was impeached and removed as president.
Given that Mr Temer was only voted in as vice president in the last election, many Brazilians have bristled at his push to pass a series of unpopular economic measures, including a cap on government spending, an overhaul of the pension system and the loosening of work rules.
The most significant measure in the labour changes would allow agreements negotiated between employers and workers on a range of issues to override current labour law. The bill would also make it easier to hire temporary workers, even for extended periods of time.
Senators still had to debate whether any amendments should be made.
Mr Oliveira and his allies hoped to get the measure passed in the Senate without any changes to the legislation that already was approved in the lower house. If passed by the Senate without changes, the bill would go directly to the president for signature. The opposition was demanding an amendment, which would send it back to the Chamber of Deputies for another vote.
Brazilian media have been predicting the bill would pass despite its low standing in polls. But the dramatic protest by opposition senators on Tuesday was a blow to Mr Temer that raised further questions about his ability to govern.
Allies of the president are counting on a victory on the labour law to give the president a boost before the Chamber of Deputies votes on whether to suspended him from office and put him on trial for corruption. That vote is not yet scheduled.
If two-thirds of deputies vote against Temer, lower house Speaker Rodrigo Maia would take over presidential duties while Brazil's Supreme Court decided whether to remove the president or find him not guilty.
The attorney general has accused Mr Temer of accepting bribes from a meatpacking executive in exchange for helping the company obtain favourable government decisions. He denies wrongdoing.