Mexico and the United States have agreed on a deal to stop the flow of illegal Central American immigrants from coming into the U.S., President Trump tweeted late Friday. The president said the deal suspended steep tariffs on imported Mexican goods that would have gone into effect on Monday.

The tariffs raised fears that they could cripple some American businesses and raise prices for American consumers on everything from cars to produce.

The deal came after three days of negotiations to stop the flow of mostly Central American migrants traveling to the U.S. through Mexico. In a joint declaration, Mexico agreed to increase its enforcement efforts along their southern border with Guatemala, including deploying their national guard troops.

Get Breaking News Delivered to Your Inbox

Mexico also agreed to take action against human smuggling and trafficking organizations.

"The tariffs scheduled to be implemented by the U.S. on Monday, against Mexico, are hereby indefinitely suspended," Mr. Trump tweeted. "Mexico, in turn, has agreed to take strong measures to stem the tide of migration through Mexico, and to our Southern Border."

Secretary of State Mike Pompeo followed the president's tweet with a statement.

"We would like to thank Mexican Foreign Minister Marcelo Ebrard for his hard work to negotiate a set of joint obligations that benefit both the United States and Mexico," Pompeo said. "The United States looks forward to working alongside Mexico to fulfill these commitments so that we can stem the tide of illegal migration across our southern border and to make our border strong and secure."

The agreement leaves open the possibility that the deal could be altered if progress is not considered sufficient. "Both parties also agree that, in the event the measures adopted do not have the expected results, they will take further actions," the agreement said.

Under the agreement, the U.S. will also "immediately" expand its Migrant Protection Protocols, also known as the "Remain-in-Mexico" policy, which started at the end of January. Individuals who are trying to come to the U.S. to seek asylum will be returned to Mexico to wait for their asylum claims to be heard in court. Mexico said that it will offer jobs, healthcare and education to the asylum-seekers.

In a series of tweets Saturday morning, Mr. Trump continued defending his last-minute decision call off the tariffs, blaming the media for perceived negative reporting. He also said Mexico had agreed to purchase "large quantities" of agricultural product from American farmers.

MEXICO HAS AGREED TO IMMEDIATELY BEGIN BUYING LARGE QUANTITIES OF AGRICULTURAL PRODUCT FROM OUR GREAT PATRIOT FARMERS! — Donald J. Trump (@realDonaldTrump) June 8, 2019

The president also tweeted that House Democrats should ratify the U.S.-Mexico-Canada Trade Agreement, the renegotiated NAFTA deal.

Mr. Trump had faced some strong criticism from Republicans who represent states with large farming populations, such as Sens. Chuck Grassley and Joni Ernst of Iowa. Ernst said in a statement Friday night that "Iowans are breathing a sigh of relief" now that the tariffs were not going into effect. It was unclear whether there were enough votes to block the tariffs from going into effect in Congress.

A tariff deal also had not seemed certain. The White House did not publicly identify what targets Mexico needed to meet, and said Mexico wasn't offering enough to curb illegal immigration. Top White House officials had insisted the tariffs were imminent if Mexico didn't drastically crack down on the flow of migrants.

Mr. Trump appeared to muddy the waters even more Friday afternoon while tweeting from Air Force One that Mexico would buy more agricultural products from the U.S. — even though the White House insisted the proposed tariffs were about immigration, not trade.

"If we are able to make the deal with Mexico, & there is a good chance that we will, they will begin purchasing Farm & Agricultural products at very high levels, starting immediately," Mr. Trump tweeted. "If we are unable to make the deal, Mexico will begin paying Tariffs at the 5% level on Monday!"

For months, Mr. Trump has vocalized his frustration over illegal immigration levels and sought ways to stem the tide of migrants, as he attempts to keep his campaign promise to build a border wall and handle illegal immigration more effectively than his predecessors. But those attempts have been fraught with hurdles, both legal and political, with the 2020 presidential election just around the corner.

Senate Minority Leader Chuck Schumer issued a statement Saturday criticizing Mr. Trump for backing down from his threat of tariffs. Schumer said the new deal would only make a "small impact on solving the root causes of Central American migration because many of the components are things Mexico is already doing."

House Speaker Nancy Pelosi was also critical of Mr. Trump, saying that he had "undermined America's preeminent leadership role in the world by recklessly threatening to impose tariffs on our close friend and neighbor to the south."

"We are deeply disappointed by the Administration's expansion of its failed Remain-in-Mexico policy, which violates the rights of asylum seekers under U.S. law and fails to address the root causes of Central American migration," Pelosi said in a statement, adding that "threats and temper tantrums are no way to negotiate foreign policy."

In December, Mr. Trump's insistence on border wall funding led to the longest government shutdown on record, but the president ultimately gave in when the impacts of the shutdown became visible.