WASHINGTON (AP) — President Donald Trump says he has suspended plans to impose tariffs on Mexico, tweeting that the country “has agreed to take strong measures” to stem the flow of Central American migrants into the United States.

“I am pleased to inform you that The United States of America has reached a signed agreement with Mexico,” Trump tweeted Friday night, saying the “Tariffs scheduled to be implemented by the U.S. on Monday, against Mexico, are hereby indefinitely suspended.”

He said Mexico has agreed to work to “stem the tide of Migration through Mexico, and to our Southern Border” and said those steps would “greatly reduce, or eliminate, Illegal Immigration coming from Mexico and into the United States.”

I am pleased to inform you that The United States of America has reached a signed agreement with Mexico. The Tariffs scheduled to be implemented by the U.S. on Monday, against Mexico, are hereby indefinitely suspended. Mexico, in turn, has agreed to take strong measures to…. — Donald J. Trump (@realDonaldTrump) June 8, 2019

He said details would be released soon by the State Departemnt.

The tweet marked a change in tone from earlier Friday, when his spokeswoman Sarah Sanders told reporters in Ireland before Trump took off: “Our position has not changed. The tariffs are going forward as of Monday.” Trump has often said unpredictability helps him negotiate.

A tax on all Mexican goods , which would increase every month up to 25% under Trump’s plan, would have had enormous economic implications for both countries. Americans bought $378 billion worth of Mexican imports last year, led by cars and auto parts. Many members of Trump’s Republican Party and business allies have urged him to reconsider — or at least postpone actually implementing the tariffs as talks continue — citing the potential harm to American consumers and manufactures.

U.S. and Mexican officials held a third day of talks at the U.S. State Department trying to hash out a deal that would satisfy Trump’s demand that Mexico dramatically increase its efforts to crack down on migrants.

The talks were said to be focused, in part, on attempting to reach a compromise on changes that would make it harder for migrants who pass through Mexico from other countries to claim asylum in the U.S., those monitoring the situation said. Mexico has opposed such a change but appeared open to considering a potential compromise that could include exceptions or waivers for different types of cases.

Trump has nonetheless embraced tariffs as a political tool he can use to force countries to comply with his demands — in this case on his signature issue of immigration. And he appeared poised earlier Friday to invoke an emergency declaration that would allow him to put the tariffs into effect if that is his final decision, according to people monitoring the talks.

“If negotiations continue to go well,” Trump “can turn that off at some point over the weekend,” Marc Short, Vice President Mike Pence’s chief of staff, told reporters.

Talks had gotten off to a shaky start Wednesday, as the U.S. once again pressed Mexico to step up enforcement on its southern border with Guatemala and to enter into a “safe third country agreement” overhauling its asylum system. But as talks progressed Thursday, U.S. officials began to grow more optimistic, with Short reporting Mexican “receptivity” to potential asylum changes.

Still, he said there was “a long way to go in that particular piece.”

In Mexico, President Andrés Manuel López Obrador would not say whether he would accept his country agreeing to be a “safe third country.”

“That is being looked at,” he said Friday morning during his daily news conference, where he held out hope a deal could be reached before Monday’s deadline.

In addition, Mexican Foreign Secretary Marcelo Ebrard said Thursday his country had agreed to deploy 6,000 National Guard troops to its border with Guatemala to help control the flow of migrants as part of its concessions.

He tweeted late Friday that there would be no “tariff application on Monday.”

“Thanks to all the people who have supported us by realizing the greatness of Mexico,” he wrote.

Beyond Trump and several White House advisers, few in his administration believe the tariffs are a good idea, according to officials familiar with internal deliberations. Those people worry about the negative economic consequences for Americans and believe the tariffs — which would likely spark retaliatory taxes on U.S. exports — would also hurt the administration politically.

Republicans in Congress have warned the White House that they are ready to stand up to the president to try to block his tariffs, which they worry would spike costs to U.S. consumers, harm the economy and imperil a major pending U.S.-Mexico-Canada trade deal .

Associated Press writers Zeke Miller, Paul Wiseman, Lisa Mascaro, Darlene Superville and Padmananda Rama in Washington and Jonathan Lemire in Shannon, Ireland contributed to this report.