Donald Trump’s critics said his hastily arranged visit to Mexico was an act of desperation, a Hail Mary pass, the sign of an erratic campaign.

But he got the world’s attention.

And the gamble paid off.

Trump used his showman’s instincts to create a television moment, setting the stage for his Arizona speech on immigration. Once President Enrique Pena Nieto extended the invitation (with Hillary Clinton declining), Trump had a chance to portray himself as a dealmaker, a bold negotiator willing to meet the adversary on his foreign turf.

What was the downside? I suppose Pena Nieto could have used the occasion to rip Trump (as the out-of-office Vicente Fox did). But a guy with a 23 percent approval rating would probably want to show that he could do business with a potential American president.

Just having a bland we-agreed-to-disagree statement would help Trump by showing him doing business on the international stage. And he got more than that.

Pena Nieto was gracious in his remarks, saying he and Trump had an “open and constructive” conversation. And when he said both countries should invest more to make the border safe, well, it wasn’t exactly thumbing his nose at Trump’s oft-repeated demand that Mexico would pay for the wall. (Trump said they didn’t discuss that, but Pena Nieto contradicted his account, saying he made clear Mexico wouldn’t pay.)

And Trump not only moderated his tone, talking about the two countries “working beautifully together,” he said he had told Pena Nieto that illegal immigration must end and NAFTA must be renegotiated. He even called the Mexican leader a “friend.” So the Republican nominee didn’t back off his positions, but showed he could calibrate his language and play in this arena.

It’s hard to imagine that the excursion could have gone better for Trump. It’s not that his insta-diplomacy will suddenly make Trump popular among Hispanic voters, but it adds to the sense that he can be reasonable, that he isn’t some hothead who will drag us into a trade war.

Clinton, as a former secretary of State, doesn’t need to do this sort of thing. But she is also too risk-averse to stage such a meeting without the details having been negotiated in advance.

Trump’s challenge in his Arizona speech was just as great: how to reconcile his tough primary rhetoric, especially about kicking out all the people who are in this country illegally, with the electoral reality that he needs to expand his base.

The problem is that there were a cacophony of sometimes contradictory voices speaking on his behalf, and it fueled a sense of confusion on what Trump himself described as a “softening” of his approach.

It also didn’t help that Trump’s people kept denying there was any change in policy on deportation, even as they kept using language that signaled such a change.

On Sunday’s “Media Buzz,” Mike Huckabee, a top Trump surrogate, told me Trump “realizes it’s utterly impractical to try to deport 11 million people, just to round them up. That’s not going to happen.” That seemed pretty clear.

Such mass roundups were never realistic, and probably less important than Trump’s signature plan for a border wall. But pressure built to the point that Trump had to make the once-delayed speech last night. But pressure built to the point that Trump had to make last night’s much-anticipated speech.

After announcing a series of get-tough measures, Trump essentially rescinded his previous policy of mass deportations of illegal immigrants, except for those who have committed crimes. He said he would figure out what to do with them after all the other steps have been implemented, which he acknowledged would take "several years."

In effect, he kicked that can down the road—which amounts to a bow to reality—while vowing to be more aggressive across the board on the immigration problem.

Will that matter? It wasn’t even the day’s biggest story. Some of Trump’s strongest detractors, including Charles Krauthammer and Steve Hayes with me on the “Special Report” panel, were praising not only Trump’s demeanor in Mexico but calling it the best day of his campaign. That visual will overshadow the retreat from a deportation plan that even many supporters thought would never be carried out. So with Hillary Clinton’s American exceptionalism speech all but blotted out, Trump, in Beltway parlance, won the day.