WASHINGTON — The Senate overwhelmingly approved a new North American trade agreement Thursday that rewrites the rules of trade with Canada and Mexico and gives President Donald Trump a major policy win before senators turn their full attention to his impeachment trial.

The vote was 89-10. The measure goes to Trump for his signature. It would replace the 25-year-old North American Free Trade Agreement, known as NAFTA, which tore down most trade barriers and triggered a surge in trade. But Trump and other critics blamed that pact for encouraging U.S. companies to move their manufacturing plants south of the border to take advantage of low-wage Mexican laborers.

Passage of the trade bill, which has come to be called USMCA, came one day after Trump signed a new trade agreement with China, easing trade tensions between the economic powers.

“Quite a week of substantive accomplishments for the nation, for the president and for our international trade," said Senate Majority Leader Mitch McConnell, R-Ky., shortly before the vote.

The final vote occurred just moments before Congress opened an impeachment trial, with House Democrats reading the formal charges from the well of the Senate. With the trial and an election year, Congress is not expected to pass many major bills. The trade bill gives lawmakers from both parties the chance to cite progress on an important economic issue before the November vote.

Trump campaigned in 2016 on ripping up trade deals that he said added to the nation’s trade deficit and cost the country manufacturing jobs. He promised he would rewrite NAFTA if elected, a pact he described as “the worst trade deal in history.” He can now go to swing states such as Michigan, Pennsylvania and Wisconsin, and tell voters he followed through on that pledge.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

But in the Oval Office, Trump fretted that the impeachment inquiry was overshadowing his trade deals when it came to top stories of the day.

“Today, we just had passed the USMCA. It’s going to take the place of NAFTA, which is a terrible deal, and the USMCA will probably be second to this witch hunt hoax," Trump said.

Mexico has already approved the agreement. Canada is expected to do so in coming months, with Prime Minister Justin Trudeau's government long insisting it would wait for U.S. approval before proceeding.

Sen. Pat Toomey, R-Pa., was a rare voice in speaking against the United States-Mexico-Canada Agreement. “It will mean higher prices for American consumers, who will have to pay more money for a car and therefore will have less money available for any of the other things they would like to consume," Toomey said. “It will probably lead to an increase or acceleration in the shift to automation.”

The agreement aims to have more cars produced in the United States, where workers earn an average of at least $16 an hour. It also secured changes that require Mexico to change its laws to make it easier for workers to form independent unions, which should improve worker conditions and wages and reduce the incentive for U.S. companies to relocate their plants.

While the administration completed its negotiations with Canada and Mexico more than a year ago, Democrats in the House insisted on changes that they said made it more likely Mexico would follow through on its commitments. As part of those negotiations, the administration agreed to drop a provision that offered expensive biologic drugs — made from living cells — 10 years of protection from cheaper knockoff competition. Democrats overwhelming opposed that provision.

Republicans and the president have complained about how long it took to complete the negotiations, but the talks resulted in a rare mix of support for a trade agreement.

The AFL-CIO, an association of trade unions, endorsed the measure, as did scores of business and farm groups. “Getting the Chamber of Commerce and the AFL-CIO to both endorse this trade deal was no easy feat, and it took both sides’ good faith efforts to get us here," said Sen. Charles Grassley, R-Iowa.

The biggest holdouts were environmental groups, which continue their opposition, saying the deal doesn’t address climate change. Indeed, they contend the agreement would contribute to rising temperatures.

“Despite the fact that it includes very good labor provisions, I am voting against USMCA because it does not address climate change, the greatest threat facing the planet," said Senate Minority Leader Chuck Schumer, D-N.Y.

Among the senators still seeking the Democratic presidential nomination, Bernie Sanders was the lone “no” vote.

The International Trade Commission projected in April that the trade agreement would boost the economy by $68 billion and add 176,000 jobs six years after taking effect. That's barely a ripple in a $21 trillion-a-year economy, but many senators noted that key industries in their state supported the agreement.