The border-security standoff between Mexico and the United States ended Friday, with an agreement that averts tariffs on vegetables, car parts, refrigerators, tequila and other imports that would have walloped both countries beginning Monday.

“I am pleased to inform you that The United States of America has reached a signed agreement with Mexico,” President Trump tweeted in announcing the pact Friday night.

The announcement came just hours after Trump returned from a five-day trip to Europe, during which Mexican and US officials negotiated in Washington.

“The Tariffs scheduled to be implemented by the U.S. on Monday, against Mexico, are hereby indefinitely suspended,” the president’s tweet said.

“Mexico, in turn, has agreed to take strong measures to stem the tide of Migration through Mexico, and to our Southern Border,” the tweet said.

“This is being done to greatly reduce, or eliminate, Illegal Immigration coming from Mexico and into the United States,” the tweet added.

Mexico has agreed to deploy its National Guard to curb migration at its southern border, the State Department said in a statement detailing the pact.

“Mexico is also taking decisive action to dismantle human smuggling and trafficking organizations as well as their illicit financial and transportation networks,” the State Department said.

“Additionally, the United States and Mexico commit to strengthen bilateral cooperation, including information sharing and coordinated actions to better protect and secure our common border.” Migrants who still manage to cross into the United States from Mexico “will be rapidly returned to Mexico, where they may await the adjudication of their asylum claims,” the statement said.

Mexico will offer jobs, health care and education to those migrants it admits “for humanitarian reasons, in compliance with its international obligations” while their asylum claims are assessed, according to the statement.

The two countries will continue discussions if migration issues persist, the statement said.

Any adjustments to the agreement would have to be made within 90 days.

The president had threatened to continue raising tariffs on Mexico to as high as 25 percent after the initial levies went into effect if Mexico didn’t meet his demands to stop migrants from reaching the United States.

And he has continued to insist that Mexico would pay the tariffs, which economists — and Trump adviser Larry Kudlow — have said would actually be paid by US importers and then likely passed along to American consumers.

Senate Republicans had threatened to attempt a veto-proof blocking of the tariffs had they actually been enacted.

Meanwhile, Mexico had prepared a list of possible retaliatory tariffs targeting US products from agricultural and industrial states that voted for Trump with an eye toward the president’s 2020 re-election bid.

The US slapped up to 25 percent tariffs on $200 billion in Chinese imports last month, prompting Beijing to levy its own tariffs on a revised target list of $60 billion in American goods. Trump said on Thursday he would decide later this month whether to carry out his threat to hit Beijing with tariffs on at least $300 billion in Chinese goods.

The president has escalated his trade war despite opposition from the US Chamber of Commerce and other conservative business and agricultural groups.

The Labor Department reported earlier Friday that job growth slowed sharply in May and wages rose less than expected, raising fears that a loss of momentum in economic activity could be spreading to the labor market.

Global equities rose on Friday on the prospect that central banks, including the Federal Reserve, would loosen monetary policy to offset trade frictions and the threat of global recession. The Dow was up more than 300 points as of 11 a.m.

Analysts had warned that tariffs could spark a recession in Mexico. Credit ratings agency Fitch downgraded Mexico’s sovereign debt rating on Wednesday, citing trade tensions among other risks, while Moody’s lowered its outlook to negative.