But the sense of reprieve also came with worry about what comes next as Trump enters a reelection campaign in which immigration is likely to be a central theme.
A former senior Mexican official, Liébano Sáenz, wrote in the newspaper Milenio that the U.S. tariff ultimatum was the “biggest challenge for Mexican diplomacy” since 1938, when a revolutionary government expropriated foreign oil companies, prompting an American boycott of the country’s goods.
After days of frantic talks to avoid Trump’s threatened tariffs, Mexico agreed to deploy thousands of national guard troops to its border with Guatemala to stem a rising flow of U.S.-bound migrants.
The government also pledged to host more migrants seeking American asylum while their U.S. court proceedings are in progress — a program that was already underway but in a more limited scope at a few points along the U.S.-Mexico border.
The new accord, however, appears to represent a significant expansion of the policy and could leave Mexico hosting nearly all Central American migrants who trek north to seek U.S. asylum.
The agreement might appear a huge political risk for President Andrés Manuel López Obrador, a leftist with a long history of support for Mexican immigrants in the United States. Some critics also raised the possibility that Trump could use tariff threats in the future to seek even more concessions from Mexico.
But the Mexican leader has two factors in his favor: his extraordinary political dominance and the country’s growing weariness with the rising number of Central Americans traversing its territory on their way to the U.S. border.
And much of the public reaction to the deal has been positive so far.
Manufacturers in Mexico — who send 80 percent of their products to the United States — breathed a sigh of relief that the tariffs were averted.
Mexican diplomats called it a triumph that they had held off U.S. demands for a “safe third country” agreement, which would have forced Central American asylum seekers to apply for refuge in Mexico, rather than in the United States.
“The bilateral relationship is strengthened for the benefit of the region,” wrote Jesús Seade, Mexico’s deputy foreign minister for North America.
Still, the crisis may do long-term damage to U.S.-Mexican ties. Over the past week, business owners who have counted on the free-trade agreement with their neighbor have questioned the reliability of the United States.
“Even if Mexico accepts all of the conditions right now, what could happen next week? Maybe Mr. Trump wakes up in the morning and decides to say something else,” said Rafael Villanueva, the president of the San Luis Potosi chapter of Index, a national manufacturing council.
López Obrador has walked a tightrope as he tried to defuse the crisis with Trump.
The president — or AMLO, as he is widely known by his initials — is the most powerful Mexican leader in decades. His party holds majorities in both houses of Congress and three-quarters of state legislatures, and opposition parties have been pulverized electorally.
The folksy, media-savvy president has maintained some of the highest popularity ratings in the hemisphere — between 60 and 80 percent, depending on the poll.
But his options were limited as he confronted Trump’s demands.
The Mexican economy is sluggish, and the bonds of the debt-ridden national oil company, Pemex, were downgraded to junk status last week by Fitch Ratings.
López Obrador is seeking to maintain economic stability as he introduces an ambitious domestic agenda including cash payments to the elderly and students, strengthening Pemex and launching infrastructure projects in Mexico’s poorer southern regions.
López Obrador calmed the public this past week by promising a negotiated solution to Trump’s threats, and Mexicans rallied around him. In a sign of his conciliatory approach, Saturday’s rally was dubbed an event “in Defense of Mexico’s Dignity” but also “in Favor of Friendship with the People of the United States.”
“Once again, Donald Trump has unified Mexico,” wrote Luis Petersen Farah, a columnist in Milenio. “With his new threats, he managed to put even the strongest and best-known critics of Andrés Manuel López Obrador on his side.”
Still, it is unclear how much Mexico could be on the hook under the tariff-averting deal with the Trump administration.
Mexico had already agreed late last year to an unprecedented arrangement in which it would allow Central American asylum seekers to wait in Mexico as their cases were processed in the United States. But the Mexican government limited the scope of the program, known as the Migrant Protection Protocols — and has accepted only about 8,500 people over six months.
If the United States sends the bulk of the asylum seekers to Mexico during often-lengthy cases, this country might suddenly see a surge of tens of thousands of migrants stuck on its northern border.
“We need to know how the Mexican government is going to contain the migrants, how they are going to identify those who make it into Mexico,” said Maki Ortíz, the mayor of Reynosa, across the border from McAllen, Tex. “We need to know how long the migrants are going to be on our border, how they’re going to get access to health services, to employment.”
In border cities such as Reynosa, migrants and deportees are frequently targeted by criminal groups, sometimes being extorted and attacked.
But the Mexican public has become far less sympathetic to the migrants after several massive caravans crossed the country starting last summer. When Trump threatened to close the border with Mexico, the daily El Universal asked in a poll what the Mexican government should do. More than 50 percent of respondents said it should block the migrants. Fewer than 25 percent responded “confront Trump.”
“Truthfully, Mexico is also at fault with these migrants. It has let them reach the U.S. border. This is bad,” said Jaime Lionel Aramburu, 58, an employee of a party-supplies company, as he pitched a tent for an event in a Tijuana park.
Central American migrants have long crossed Mexico as they tried to reach the U.S. border. But their numbers have soared this year. In addition, the caravans made the migrant journeys more visible than in the past, when most traveled under the radar with smugglers.
In Washington, meanwhile, Democrats described the turbulent week of tariff fears and political brinkmanship as another example of Trump’s claiming credit for fixing a crisis of his own making.
“President Trump undermined America’s preeminent leadership role in the world by recklessly threatening to impose tariffs on our close friend and neighbor to the south,” House Speaker Nancy Pelosi (D-Calif.) said in a statement. “Threats and temper tantrums are no way to negotiate foreign policy.”
Several Democratic presidential candidates also decried Trump’s penchant for threats as undermining U.S. credibility.
“What we see is yet another example of him trying to be both the arsonist who created this problem in the first place and the firefighter who wants credit for addressing it,” former congressman Beto O’Rourke wrote on Twitter.
Pete Buttigieg, the mayor of South Bend, Ind., said the United States needs a “comprehensive strategy, not just a pattern of poking folks in the eye.”
“Mexico cannot and should not bend the knee to Trump’s ultimatum,” said Arturo Sarukhan, a former Mexican ambassador to the United States.
He called the episode a “bad omen” and worried that Trump could seek again to pressure Mexico as the 2020 presidential race heats up.
“More than a deal, what Trump is looking for is a trophy,” Sarukhan said.
Gabriela Martinez in Mexico City contributed to this report.