The Senate approved a sweeping U.S. economic pact with Canada and Mexico on Thursday, delivering on President Trump’s promise of a new North American trade deal, just ahead of his impeachment trial.

The vote was 89 to 10, with an overwhelming majority of senators from both parties supporting the agreement, as expected. Last month, the House approved the revised agreement by a similarly wide margin, after months of negotiations between Democrats and the White House produced pro-labor revisions and jettisoned drug-exclusivity language sought by the pharmaceutical industry. The 12 million-member AFL-CIO was closely involved in negotiating the changes and backed the agreement, along with some other major unions.

Speaking on the Senate floor Wednesday, Majority Leader Mitch McConnell (R-Ky.) called passage of the deal “a major win for Kentucky and all 50 states, a major win for our country, a major win for the Trump administration.”

Passage of the U.S.-Mexico-Canada Agreement hands Trump a key victory at a moment of political peril, with the Senate poised to begin his impeachment trial after the House delivered its articles of impeachment Wednesday evening. Trump made his opposition to the 25-year-old North American Free Trade Agreement, or NAFTA, a centerpiece of his campaign for president in 2016. He can now boast of delivering a new trade deal that includes major new protections for American workers, even though many of those were negotiated by House Democrats over the objection of Senate Republicans.

Trump must still sign the revised North American trade deal, something he suggested he will probably do next week.

Senate Republicans had little influence in the process, because Speaker Nancy Pelosi (D-Calif.) held a make-or-break role in deciding whether to bring the deal up on the floor of the House, which by law had to act first on the agreement. The role played by House Democrats and their allies in labor angered some Republicans, including Sen. Patrick J. Toomey (R-Pa.), the deal’s most outspoken opponent, who complained that the Senate got “rolled” in the process.

But supporters including Senate Finance Committee Chairman Charles E. Grassley (R-Iowa) said they had no choice but to support the deal that was before them. They called it good news for the U.S. economy and workers, pointing to initial projections from the International Trade Commission that it will add 176,000 U.S. jobs — although that amounts to increasing employment by just 0.12 percent, a modest impact on the nearly $21 trillion U.S. economy.

One provision, allowing Mexican workers to lodge complaints about working conditions that could result in punitive action by the United States, was included at the insistence of Sen. Sherrod Brown (D-Ohio), a leading trade protectionist who announced his support for the USMCA after opposing all previous free-trade agreements.

The deal created divisions in the Democratic presidential primary field. In a debate Tuesday night, Sen. Bernie Sanders (I-Vt.) predicted that the agreement would lead to the continued outsourcing of U.S. jobs. “We could do much better than a Trump-led trade deal,” he said. But other leading candidates, including former vice president Joe Biden and Sen. Elizabeth Warren (D-Mass.), support the deal. Warren called it a “modest improvement” that will deliver needed relief to farmers and workers hurt by Trump’s trade policies.

Senate Minority Leader Charles E. Schumer (D-N.Y.) voted against the USMCA, saying that while the deal does include labor provisions, “it does not address climate change, the greatest threat facing the planet.” In a statement, Schumer said that the Trump administration is giving incentives for manufacturers to move businesses and jobs from the United States to Mexico, which has weaker regulations for clean air and water.

“The Trump administration also included handouts for the oil and gas industry, such as lifting tariffs on tar sands, and refused to include any mention of the climate crisis in the agreement,” Schumer said.

Thursday’s vote came a day after Trump signed a partial economic deal with China, nearly two years into a protracted trade war with Beijing. As part of the deal, China committed to purchasing an additional $200 billion in American exports above previous levels. With the USMCA vote, Trump has back-to-back victories on trade that may calm the waters after the president has ramped up trade tensions around the world and leveled tariffs on friends and foes.

The USMCA was signed more than a year ago by Trump and the leaders of Mexico and Canada but had to be approved by the legislatures in all three nations. Mexico has already acted, and Canada’s Parliament is expected to follow the United States and approve the deal in the next several months. After some additional procedural steps, the deal is expected to take effect later this year.

House Democrats called for substantial changes to the initial draft of the USMCA and worked directly with U.S. Trade Representative Robert E. Lighthizer in months of secretive talks that stayed largely on track even as the House moved forward to impeach the president.

House Democrats pointed to wins on stronger environmental and enforcement language, the protections for workers in Mexico and the killing of the provision sought by pharmaceutical companies that would have guaranteed 10 years of market exclusivity for a costly class of drugs called biologics. Many labor unions were also encouraged by the deal, which could help keep American and Canadian jobs from going to lower-paying markets in Mexico or Asia. Under the deal, at least 30 percent of cars (and 40 percent by 2023) must be made by workers earning $16 an hour, which is about three times the manufacturing wage in Mexico.

The USMCA also gives American dairy farmers more access to the Canadian market, especially for “Class 7” milk products such as milk powder and milk proteins. The deal puts some restrictions on how much dairy Canada can export, which could help American dairy farmers edge into foreign markets.

The USMCA also includes new rules for digital trade, something that barely existed when NAFTA was written. Among these, however, is a provision that provides protections to big tech companies by giving legal immunity to Internet platforms over content posted by users. Pelosi opposed the provision but was unsuccessful in keeping it out of the deal in the final stages of talks last month. She cited it as her one disappointment in how the deal turned out.

Economists also worry that the USMCA will spur a spike in car prices, especially on smaller cars that used to be produced in Mexico but may be subject to duties at the border. U.S. tariffs on Canadian steel are also still in place.

And while tensions have now cooled between Washington and Beijing after nearly two years of trade escalation, there are few details about what the second phase of a U.S.-China trade agreement will look like — even as many American sectors and businesses say they are still pinned under tariffs that remain in place.