MEXICO CITY (AP) — Mexico’s Senate approved a labor law overhaul Monday night aimed at ensuring workers can freely vote for their union representation and contracts.

The new law requires secret-ballot union votes and proof of workers’ consent for contracts. The changes are needed to win approval of the new U.S.-Mexico-Canada trade agreement, which was negotiated to replace the old NAFTA accord.

U.S. and Canadian legislators, angered that Mexico has lured auto manufacturing plants with low salaries, have demanded Mexico change labor laws that encouraged wages as low as $1 or $2 per hour at some plants.

Mexico’s labor movement has long been stymied, and wages kept low, by pro-government unions that sign contracts and organize plants behind workers’ backs.

Because a lack of transparency, companies were often able to sign contracts with compliant union representatives before they ever even opened plants in Mexico. Unions were often so absent that many workers were unaware they even had a union at their plant. Votes were often held by a show of hands, in sight of union enforcers, or workers weren’t invited to vote at all.

Old-guard union leaders were often active members of the old ruling Institutional Revolutionary Party, and the government allowed their leaders to stay in office for decades with little oversight or scrutiny.

The new law transfers the resolution of disputes over contracts and union representation to special courts.

Since President Andres Manuel Lopez Obrador took office Dec. 1, labor unions already have staged a wave of strikes and formed new federations to take advantage of the greater freedom.

The bill approved Monday night now goes to the president to be signed into law.