May 1 is International Workers’ Day, and employees in Mexico have good reason to celebrate: They just won the right to organize and negotiate their own pay.

Mexican President Andrés Manuel López Obrador enacted a labor reform bill Wednesday that for the first time gives workers the legal right to bargain collectively with employers through independent labor unions, without fear of retaliation or harassment. The bill sailed through the House of Representatives earlier this month, and senators unanimously passed the bill Monday.

“This is a huge advancement for Mexico’s workers,” López Obrador said during his daily press conference Tuesday morning in Mexico City. “Before this reform, workers couldn’t vote freely, by secret ballot, to elect their union representatives. Now workers can choose.”

It is indeed a huge victory for workers in Mexico, and ironically, US President Donald Trump helped them get it.

As part of the new trade deal Trump negotiated with Mexico and Canada in November, known as the USMCA, then-Mexican President Enrique Peña Nieto promised to overhaul its labor laws. And Mexico’s new populist president, López Obrador, agreed.

The USMCA, if approved by lawmakers in all three countries, would replace the current NAFTA deal, which Trump has long blamed for decimating the US manufacturing industry. The point of including labor reform in the new trade deal was to improve working conditions in Mexico, so that US manufacturers have less financial incentive to move factory jobs across the border.

But not everyone in Washington is on board yet. Trump is getting resistance from US labor unions and House Democrats, who think the USMCA doesn’t do enough to make sure Mexico enforces its new labor laws. Regardless of what happens next, Mexican workers have already scored a major victory from the new trade deal.

Mexican workers were powerless, and NAFTA kept it that way

It’s hard to overstate the potential impact of Mexico’s labor reform bill.

Until now, Mexico was the only country in Latin America (and one of the few left in the world) that did not give workers the right to organize freely and engage in collective bargaining. Mexico has many labor unions, but businesses and government officials have long controlled them, rarely giving workers any input in negotiating labor contracts. That’s one major reason Mexico has the lowest wages in the developed world — a setup encouraged by US companies that have set up factories there.

The average wage for factory workers in Mexico is just over $2 an hour, and the country’s minimum wage is roughly $4.15 for a full day’s work. These low wages have motivated US companies, such as Ford and General Electric, to move operations south of the border.

In Mexico, US manufacturers — and most other companies — end up dictating the terms of their contracts with labor unions to their own benefit, without any input or approval from employees. Workers have also reported retaliation from employers when they try to create a labor union.

But under the new law, Mexican workers are getting many of the same rights available to workers in the United States. That includes the right to vote by secret ballot to organize a labor union, and to pick their union representatives.

All of Mexico’s main political parties had endorsed the changes, a rare moment of unity in Mexico City. But many Mexican businesses are not thrilled about losing leverage.

Gustavo de Hoyos, president of the powerful business lobby group Coparmex, said it was shameful that Mexico let the United States dictate legislation.

“It won’t bring growth and doesn’t incentivize investment,” de Hoyos said Tuesday in an interview with El Universal newspaper.

Trump’s threat of ending free trade with Mexico and Canada, though, was enough to get most of Mexico’s elite on board with the overhaul. As part of the bill, Mexico will create a government agency to enforce workers’ right to unionize, similar to the US National Labor Relations Board.

That’s a crucial part of the package, considering that enforcement will likely be the biggest challenge.

NAFTA was supposed to protect workers, but it didn’t

When NAFTA was signed in 1994, it included labor protections for workers in all three countries: the US, Mexico, and Canada. Basically, each country agreed to enforce its own labor laws and follow standards set by the United Nations’ International Labor Organization.

But labor complaints filed through the NAFTA labor dispute process have led nowhere.

About two dozen complaints of workers’ rights violations were filed against all three countries in NAFTA’s first decade — the vast majority in Mexico, according to Human Rights Watch. Companies accused of violating local labor laws include General Electric, Honeywell, Sony, General Motors, McDonald’s, Sprint, and the Washington state apple industry.

In Mexico, those complaints included allegations of retaliation against workers who tried to unionize, denial of collective bargaining rights, forced pregnancy testing, mistreatment of migrant workers, and life-threatening health and safety conditions. None has led to any sanctions; workers’ rights groups say this is because there are no rules about how to resolve these disputes and government mediators have chosen to take a hands-off approach.

“Our research shows that agreements on labor will never work without the active support of the countries involved. In the case of NAFTA, these three countries have actually worked to minimize the impact of the labor provisions,” the HRW report stated.

The new labor rules in Trump’s pact with Mexico are supposed to remove the incentive to keep Mexican workers living in poverty. Under the new deal, the United States can use the same dispute system to resolve labor complaints that NAFTA previously allowed only for commercial trade violations (such as exceeding trade quotas).

Now that Mexico passed the promised overhaul, López Obrador said it’s up to the US to get the USMCA ratified.

“Mexico made a commitment, and we followed through with it,” he said Tuesday. “Now it’s up to members of Congress in the US to finish it.”

Workers in Mexico celebrated, as they took to the streets Wednesday for the annual Workers’ Day parades.

A former senator from Mexico City, Carlos Sotelo García, put the milestone into perspective on Twitter Wednesday.

“Decades of struggles, murders, harassment, and jailings are the precedent for this historic conquest,” he tweeted.

Correction: A previous version of this article mistakenly stated that Harley Davidson had a factory in Mexico.