BUENOS AIRES — With his signing of a new deal with Mexico and Canada to replace the quarter-century-old North American Free Trade Agreement, President Trump on Friday claimed a victory for his hard-line approach to trade. He had pushed to the brink and won concessions, just as he said he would.

Hanging over the win, however, is not only the question of whether Congress — with a new Democratic House majority in January — will approve the deal, but also what the future cost of Trump’s bruising tactics may be for U.S. trade relations generally — including with China, the world’s other economic superpower.

The American president had shown this country’s two neighbors that going it alone and ignoring age-old alliances can pay off, at least in the short term. Yet if the United States no longer values established norms of restraint and mutual consideration, Canada and Mexico — as well as other longtime trading partners — are not likely to feel constrained, either.

A first test looms here at the Group of 20 summit of leaders of the world’s most developed nations, which opened just after the leaders of the three North American nations signed their trade pact in a ceremony on the sidelines. The central question at the gathering is whether Trump’s trade war with China will grow hotter, especially if President Xi Jinping remains as resolutely hard-line as the American president, given the potential risks for the global economy.

Trump and Xi are set to meet over dinner after the G-20 concludes Saturday.

“The bottom line is that if the Trump-Xi meeting ends badly and the two countries slip into a deeper cold war mindset, the U.S. is likely to become more vocal about engagements by its traditional allies with China,” said Eric Miller, a global fellow at the Wilson Center in Washington.

For example, Miller added, for the United States “this means pushing Canada to limit its engagements with China.”

Yet Canada, perhaps in response to Trump’s aggressive trade stance, is exploring new trade opportunities with China. It is doing so though one of the new trade agreement provisions seeks to restrain Canada or Mexico from making deals with a state-run, non-market economy — namely China.

Trump touted the revised accord with Mexico and Canada as “a truly groundbreaking achievement.” But there was no disguising the tensions lingering from his zero-sum, winner-take-all approach to negotiating with allies.

Canadian Prime Minister Justin Trudeau, who considered skipping the formal signing that Trump was eager for, chose not to follow Trump’s lead and hold up the agreement for the cameras. And he pointedly declined to refer to the agreement by the name that the brand-conscious Trump had given it — the United States-Mexico-Canada Agreement, or USMCA, an acronym that Trump says recalls the title of a catchy hit song from 40 years ago, “YMCA.”

Even after concluding the deal, Trump has not lifted duties on Canadian and Mexican steel and aluminum, which meant those countries have left in place retaliatory tariffs against U.S. goods. Europe and China have imposed counter-tariffs against American products as well.

While manufacturing and business groups applauded the signing Friday, because the pact lifted the uncertainty that has been weighing on companies, down at the grass roots there was less joy.

“Any gains will continue to be offset by the losses farmers are experiencing from retaliatory tariffs as long as they are in place,” said Brian Kuehl, executive director of Farmers for Free Trade, a bipartisan campaign co-chaired by former Sens. Max Baucus and Richard Lugar.

The trade deal has the potential to benefit U.S. farmers. It kept intact the largely tariff-free provisions that have boosted trade among the three nations to more than $1 trillion annually, while pressuring Canada to open its dairy market. Auto trading rules were tightened, and provisions would push Mexico to raise wages, which could slow the loss of jobs to that country.

Even so, congressional Democrats have signaled they won’t support the deal without additional protections for workers, though the new trade agreement calls for some more safeguards than NAFTA.

“The basic issue is Mexico’s structure of keeping wages way, way down,” said Rep. Sander M. Levin of Michigan, a foremost voice on trade issues for House Democrats.

The revised pact, which comes after a long, difficult negotiation, won’t replace NAFTA until it’s been approved by the legislatures of all three countries.

Trump since his campaign had called NAFTA, enacted in 1994, the worst trade deal in history, though much of it is carried over in the new version. The president falsely claimed the new deal was “the largest trade deal ever made” and asserted that it will lead to higher wages in the auto industry and bring back jobs that have been moved overseas.

Trump did not refer to General Motors’ recently announced plans to cut jobs at five North American factories, four in the United States and one in Canada. Trudeau did, however, calling it a “heavy blow.” He urged Trump to remove tariffs on Canadian steel and aluminum, which have been cited as a factor in GM’s decision to cut costs.

“Make no mistake, we will stand up for our workers and fight for their families and their communities,” he said, before addressing Trump directly. “Donald, it’s all the more reason why we need to keep working to remove the tariffs on steel and aluminum between our countries.”

Despite Trump’s hostile rhetoric about immigrants crossing illegally into the United States from Mexico, he appeared to be on better terms with that nation’s president, Enrique Peña Nieto, who was serving his final day in office.

Prior to the signing ceremony, Peña Nieto awarded Jared Kushner, the president’s son-in-law and advisor, who was involved throughout the trade talks, the Order of the Aztec Eagle, Mexico’s highest award.

Afterward, as the G-20 summit began, much attention focused on whether Trump would engage with either Russian President Vladimir Putin — a day after abruptly canceling their scheduled meeting here — or with Saudi Crown Prince Mohammed bin Salman, whose alleged complicity in the brutal killing of U.S.-based Saudi journalist Jamal Khashoggi has roiled relations between the U.S. and Saudi Arabia.

Trump has continued to accept Mohammed’s claims of innocence, just as he has accepted Putin’s insistence that he did not interfere in the 2016 U.S. election — despite, in each case, U.S. intelligence agencies’ conclusions to the contrary.

As the many leaders gathered for the traditional “family photo,” Trump kept his distance from the two controversial leaders, who greeted each other with grins and an exaggerated handshake, appearing to revel before the cameras in their shared notoriety.

Soon, however, Trump “exchanged pleasantries” with the crown prince, according to a White House official. The president later told reporters that the two men “had no discussion” but that “we might” before the summit concludes on Saturday.

Trump continued to insist that he canceled his planned one-on-one meeting with Putin because of Russia’s recent seizure of three Ukrainian vessels and their sailors. He called that action “the sole reason” for the cancellation, suggesting that his decision had nothing to do with damaging new developments in the special counsel’s investigation of possible collusion between Russia and Trump’s 2016 presidential campaign.

As Trump left Washington for Argentina on Thursday, his former attorney and fixer Michael Cohen pleaded guilty to lying to Congress about the Trump Organization’s business dealings with Russian interests in 2016, and implicated the president.

Undercutting Trump’s claim that Moscow’s hostile actions were to blame for the newest tension with Russia, White House Press Secretary Sarah Huckabee Sanders gave summit reporters a statement blaming the special counsel’s inquiry for straining U.S.-Russian relations.

“The Russian Witch Hunt Hoax, which is hopefully now nearing an end, is doing very well,” she said in the statement. “Unfortunately, it probably does undermine our relationship with Russia.”

Trump began the day by illustrating that the investigation back in Washington, led by special counsel Robert S. Mueller III, is what is most on his mind even as he meets with world leaders.

On Twitter, he defended himself amid the news that, with his knowledge, Cohen continued to negotiate with representatives in Moscow for a proposed luxury tower there well into 2016, longer than they’d previously admitted. The president tweeted that the business effort was “very legal & very cool.”