Piñatas of Mexican President Andrés Manuel López Obrador and President Trump at a market in Tijuana, Mexico, on Saturday. (Hans-Maximo Musielik/AP)

As President Trump spent Saturday morning celebrating his deal with Mexico to stem the entry of migrants into the United States, Democrats denounced it as another example of the president’s 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.”

The U.S. and Mexican governments announced Friday night that they had reached a deal in which the White House would hold off on its threat to impose a 5 percent tariff on all Mexican goods being imported into the United States. In exchange, Mexico agreed to implement “strong measures” to slow the flow of migrants across its territory toward the southern U.S. border.

“Everyone very excited about the new deal with Mexico!” Trump wrote in one of seven related tweets he sent before 10 a.m.

Republicans praised the agreement and expressed relief that the president would not resort to across-the-board tariffs against one of the country’s top trade partners. Sen. Marco Rubio (R-Fla.) said in a statement that while he did not support imposing tariffs on Mexico, he commended Trump’s “exerting maximum pressure and demanding decisive action” from the Mexican government on immigration issues.

Mexico promised the White House that it would mobilize its national guard to help with immigration enforcement and expand a Trump-era program that forces asylum-seekers to wait out their immigration hearings in Mexico rather than in the United States.

Several of Trump’s would-be 2020 Democratic challengers condemned the deal and how it was reached.

“The damage of Trump’s reckless trade policies and tariffs has already been done,” former congressman Beto O’Rourke said on Twitter. “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.”

After a campaign event in Des Moines Saturday, Pete Buttigieg said the president’s deal amounted to a “face saving maneuver” for a negotiating tactic that wasn’t working.

“We need a comprehensive strategy, not just a pattern of poking folks in the eye,” said Buttigieg, the mayor of South Bend, Ind. “It was clear the administration itself had really not thought this through. They just went to the brink, frightened the markets, got a superficial concession, and then went back right back to where we were. This is no way to manage our trade policy or our immigration policy.”

David Weigel in Des Moines contributed to this report.