Open this photo in gallery:

Mexican President Claudia Sheinbaum’s rapport with Donald Trump is one of the reasons several things have worked in Mexico’s favour during the trade wars.LUIS ANTONIO ROJAS/The New York Times News Service

Next month Prime Minister Mark Carney is set to travel to Mexico to meet his counterpart as the two countries struggle with the erratic trade policies of the United States.

One question he may have for Mexican President Claudia Sheinbaum: How does her country stay on U.S. President Donald Trump’s good side?

As the trade war has dragged on, Mexico has seemed to benefit from a softer touch by the White House, at least compared with the mercurial president’s recent treatment of Canada.

And while the difference reflects a number of factors unique to Mexico, experts see potential lessons for Canada – lessons which Mr. Carney, who on Friday said Canada would drop its retaliatory tariffs on U.S. goods imported under the North American trade pact, already appears to be heeding.

Trump’s trade war is hammering Canada much harder than Mexico

The gap in Mr. Trump’s approach was on full display earlier this month. On Aug. 1 he hiked the tariff on Canadian imports to 35 per cent for those products not covered by the United States-Mexico-Canada Agreement. Just the day before he granted Mexico another 90-day reprieve on his vow to raise Mexico’s broad tariff rate to a lower 30 per cent.

Canada and Mexico, along with China, were early targets for Mr. Trump’s campaign to reshape the global trading order. His first volley was to impose the so-called fentanyl tariffs, originally at 25 per cent, on the countries.

However, the U.S. quickly offered a concession to its two closest neighbours unavailable to any other trading partner: the exemption from duties for imports that comply with USMCA.

Yet while U.S. Census Bureau data show a larger share of imports from Canada entered the U.S. duty-free than from Mexico – 92 per cent compared with 84 per cent, as of June – the value of goods shipped from Canada were 13.7 per cent lower that month compared with a year earlier, while imports from Mexico are up 6.3 per cent.

The mix of goods the two countries send to the U.S. explains part of the divergence.

The value of Canada’s largest export to the U.S. – crude oil – fell as a result of lower oil prices.

Meanwhile Mexico’s largest export, computers, soared 64 per cent as U.S. importers shifted away from China. When the Trump administration this week expanded the list of products containing steel and aluminum to be tariffed at 50 per cent, it included everything from appliances to toys, aftershave and concentrated milk. But the U.S. left computers off the list.

“Despite trade protectionism, Trump is allowing trade with Mexico to grow (in the shadows) in certain products that the U.S. previously imported from China,” Gabriela Siller, director of analysis at Grupo Financiero Base, wrote in a note to clients.

The steel and aluminum tariffs, part of a handful of sectoral duties Mr. Trump has imposed, have fallen particularly heavily on Canada. Last year those products accounted for 6 per cent of Canada’s shipments to the U.S., versus around 2 per cent for Mexico.

The growth in Mexican exports to the U.S. extends a winning streak over the past decade in which it overtook Canada and then China to become the largest exporter to the U.S.

“The fact that Mexico has been gaining share of U.S. imports is not a new thing, we’ve been doing well for a long time,” said Joan Domene, the Mexico-based chief economist for Latin America at Oxford Economics.

But several things have worked in Mexico’s favour during the trade wars, not the least of which is the rapport Ms. Sheinbaum has developed with Mr. Trump.

“Maybe it’s because we have the first female president and she’s used to dealing with a lot of rowdy men, she knows that the best option was to say ‘whatever you want, Mr. President,’ and then do whatever we need to do,” Mr. Domene said.

Analysis: Mexico’s Sheinbaum has more leeway than Carney when dealing with Trump

Mr. Carney has had a far smoother relationship with Mr. Trump than his predecessor, Justin Trudeau, did. But after the two met at the G7 leaders’ summit in Kananaskis, Alta., in June, Mr. Trump said, “Mark has a more complex idea” of what an agreement between Canada and the U.S. should look like.

“Part of the problem is our prime minister is a numbers guy, and Trump is not a numbers guy, he’s a ‘Let’s go for the big deal’ guy,” said Fen Hampson, a professor of international affairs at Carleton University. “Trump obviously respects Mr. Carney but that has not translated into personal chemistry. Sheinbaum clearly has the personal edge there.”

Open this photo in gallery:

Sheinbaum gifts Prime Minister Mark Carney a soccer ball at the G7 Leader’s Summit in June. Canada and Mexico have handled U.S. tariffs in very different ways.Amber Bracken/Reuters

Canada was also quick to punch back at Mr. Trump’s tariffs in ways that Mexico has not.

Mr. Trudeau slapped countertariffs on U.S. imports and Canadians have boycotted southbound travel in droves. At the same time, provinces stopped selling U.S. alcohol, and Ontario Premier Doug Ford, a fixture on U.S. cable television where he derides Mr. Trump’s actions, came close to restricting Ontario electricity exports to several U.S. states.

Mr. Carney, who won the federal election on a campaign of an “elbows up” attitude to the U.S., has since softened Canada’s response. His government scrapped its digital sales tax at Mr. Trump’s urging, and opted not to increase countertariffs to match the latest U.S. tariff hike.

Then on Friday Mr. Carney, following a phone call with Mr. Trump, said Canada will remove tariffs on U.S. goods that comply with USMCA starting Sept. 1. He framed the move as “matching” Mr. Trump’s earlier exemption.

Still, Canada and China remain the only countries with any retaliatory duties in place.

Mexico was far more conciliatory from the outset, with the country largely caving to Mr. Trump’s demands on security and migration, and declining to join Canada in imposing tariffs on imports from the U.S., Mr. Domene said.

At the end of July, Mexico also raised import taxes on small shipments from countries it doesn’t have trade deals with, in particular China, to 33.5 per cent after the Trump administration accused Chinese e-commerce companies of using Mexico as a back door to send cheap goods to the U.S.

“We haven’t done anything to retaliate or escalate,” Mr. Domene said. “Every time the U.S. has demanded anything from Mexico, we have complied.”

It’s hard to envision a scenario where Mexico’s strategy of laying down completely would fly with Canadian voters. There remains broad support to strike back at the U.S., even if it carries consequences for Canada.

That leaves Mr. Carney to walk a treacherous tightrope between appeasement and retaliation.

Indeed, the expansionist rhetoric from Mr. Trump that angered so many Canadians may explain his different approach to the two countries.

While the President has dialled back the 51st-state taunts since Mr. Trudeau stepped down, some experts believe he still wants Canada to enter some form of common economic union with the U.S., in which Canada perhaps mirrors that country’s tariff policy or provides preferential access to Canadian natural resources.

“He may think, ‘If I really stick it to the Canadians, they may do my bidding’,” Prof. Hampson said. “Trump has no similar desire to annex Mexico; he’s never talked about that.”

Despite Mexico’s apparent edge, companies that rely on the country’s low-cost work force to supply goods to Americans are anxious.

Entrada Group, a Texas-based company, operates shelter manufacturing facilities in two Mexican cities, with 4,500 employees. It leases out its space and work force to other foreign companies looking to export from Mexico without the need to obtain their own business licences and certifications.

“If you’re already operating in Mexico this has accelerated growth, because there is stability and at the end of the day the country is still cost-competitive even with tariffs,” said John-Paul McDaris, director of business development at Entrada.

“But prospective companies that were looking at Mexico are holding back on investment and saying let’s wait a year.”

Open this photo in gallery:

An employee works on a BMW 3 Series car body in San Luis Potosi, Mexico. Mexican shipments of cars and car parts to the U.S. have increased while Canada’s have fallen.JOSUE GONZALEZ/Reuters

One area where Mexico is pulling further ahead is in the auto sector. Mexico may face the same headwinds as Canada from Mr. Trump’s push to move manufacturing to the U.S., but its shipments of passenger vehicles and parts to the U.S. have grown while U.S. imports from Canada have tumbled.

In addition, Mexico has seized market share from the U.S. in Canada amid the trade war. In June Canada imported more passenger vehicles from Mexico than the U.S. for the first time as imports of U.S.-produced vehicles tumbled to the lowest level for that month since 2010.

Still, many argue the gap between how the two countries are handling the trade crisis is not as wide as it seems.

Flavio Volpe, president of the Automotive Parts Manufacturers’ Association, which represents Canadian original equipment suppliers, said he doesn’t “see much daylight” between how Mr. Carney and Ms. Sheinbaum are dealing with Mr. Trump.

Canada and Mexico “continue conversations that could end at any time with a positive conclusion,” he said. “The only thing Mexico has is a promise of 90 days of peace from somebody who regularly breaks his promises.”

It’s also too early to draw conclusions based on the first few months of the trade war because the rush to move inventory into the U.S. ahead of the tariffs has distorted trade flows.

“Companies in Mexico expected tariffs more than those in Canada did so they did more to try to front-run tariffs by sending exports ahead of time,” said Eduardo Suárez, vice-president of Latin America economics at Bank of Nova Scotia. “We’re going to need to see a year or more of data to assess the outcome.”

Few are banking that “just because Mexico has been resilient in the first few months of the trade war that this is going to be the way going forward,” said Mr. Domene at Oxford Economics.

He noted that if Mr. Trump believes Mexico is getting off unduly easy, “he’s just going to get bolder and crazier.” At the same time, if tariffs continue to hit U.S. consumers and slow demand, Mexico is particularly exposed to a U.S. downturn.

As for Mr. McDaris at Entrada, even with the 90-day pause Mr. Trump granted Mexico to Nov. 10, the only question that really matters is what comes out of negotiations to renew the USMCA deal, which is up for review next year.

“Until we get to the table for 2026, I’m not hanging my hat on anything that happens in November,” he said.