All the hysteria over President Trump’s latest tariff threat to Mexico proved wrong Friday, as the two sides reached a deal that gave Trump what he’d demanded: much more vigorous cooperation in stopping illegal Central American migrants from travelling 1,200-plus miles across Mexico to sneak into the United States.

It may not stop the surge that’s crossed the 100,000-a-month line, overwhelming the Border Patrol as well as the various social-service agencies that have to handle these immigrants. But it’s sure a huge step.

With the Democrats who control the House refusing to OK emergency funds to deal with this humanitarian crisis, the president took a brilliant step outside the box when he publicly upped the pressure on Mexican President Andrés Manuel López Obrador to finally start doing his part.

Yes, AMLO’s people had been negotiating with Team Trump on these issues for months, and it may even be the case, as The New York Times reports, that Mexican officials had tentatively signed off on much of the new plan. So what?

Recall as Beijing’s recent retreat from promises its negotiators had in US-China trade talks shows: Apparent concessions just don’t mean much until you reach a complete agreement.

And Washington needed that agreement now: The shortage of funds is forcing major cuts in services, canceling recreation and education programs for unaccompanied minor children being detained.

Plus, having the Border Patrol swamped by “refugees” is a huge windfall for drug smugglers — which is a big reason why the big narco rings helped foster this surge in the first place.

The left loves to paint this crisis as entirely Trump’s fault, regularly calling the migrants “asylum seekers” as if the president’s simply trying to keep helpless refugees from finding safety. But the fact is that now, as in the Obama years, the overwhelming share of asylum claims don’t pan out — but now migrants know it’s a way to exploit US law so they can stay here anyway. If simple safety were the goal, there’s 1,200 miles of Mexico you could stop in.

Note that other “tranverse” countries have been making cynical use of similar migrants. Turkish tyrant Tayyip Recep Erdogan triggered the 2015 crisis in Europe by suddenly opening the doors for migrants from across the Middle East to cross to the East — until the powers of the European Union bribed him into flipping the switch back the other way.

Trump opted for threats instead of bribery. Good for him — and too bad he can’t impose tariffs on Congress.