USMCA, as the deal is called, modernizes but doesn’t fundamentally change Nafta. Trump had threatened to impose tariffs on all goods from Mexico if it doesn’t stop illegal border crossings, risking derailing the accord’s ratification earlier this month. But it’s back on track after Mexico struck a deal with him on migration and he dropped the threat, for now.

“No international accord is ideal,” Mexican Senator Hector Vasconcelos, who heads the foreign relations committee, said before the vote. “What’s important is that each participant finds advantages in them.”

Mexico had originally planned to ratify the USMCA in tandem with Canada and the U.S., but Lopez Obrador requested swift approval of the deal.

U.S. House Democrats, which hold a majority, are likely to seek changes to the deal before they approve it. U.S. Trade Representative Robert Lighthizer said Tuesday he’s committed to working with Democrats on changes.