Trump, who has made cracking down on illegal immigration a top political priority, has said he could shut down border crossings before without following through on the threat. However, his threat Friday comes at a particularly delicate time: his administration hopes Congress will ratify a replacement of the 1994 North American Free Trade Agreement by this summer.

In a series of tweets Friday, the president wrote that he would shut down "the Border, or large sections of the Border," if Mexico does not "immediately stop ALL illegal immigration coming into the United States throug (sic) our Southern Border." He claimed closing off border crossings, key avenues for trade with a major partner, "would be a good thing!"

President Donald Trump threatened to close large parts of the U.S.-Mexico border next week if America's southern neighbor does not "immediately" stop illegal immigration.

It would likely be difficult for Mexico to "immediately" stop "all" illegal immigration, as Trump asks.

Trump tweet 1: The DEMOCRATS have given us the weakest immigration laws anywhere in the World. Mexico has the strongest, & they make more than $100 Billion a year on the U.S. Therefore, CONGRESS MUST CHANGE OUR WEAK IMMIGRATION LAWS NOW, & Mexico must stop illegals from entering the U.S....

Trump tweet 2: ....through their country and our Southern Border. Mexico has for many years made a fortune off of the U.S., far greater than Border Costs. If Mexico doesn't immediately stop ALL illegal immigration coming into the United States throug our Southern Border, I will be CLOSING.....

Trump tweet 3: ....the Border, or large sections of the Border, next week. This would be so easy for Mexico to do, but they just take our money and "talk." Besides, we lose so much money with them, especially when you add in drug trafficking etc.), that the Border closing would be a good thing!

Later Friday, White House spokesman Hogan Gidley said he did not have an announcement "at this time" about Trump closing down the border, but added that the president "has got to do something to fix it and he's looking at all his options." While Trump made the threat more than once Friday, his administration did not appear to take any concrete steps toward closing the border.

In response to the president's tweets, Mexican Foreign Secretary Marcelo Ebrard said Mexico would not respond to threats. He called Mexico a "great neighbor" to the U.S. He added that 1.5 million Americans live in Mexico.

Ebrard tweet: México no actúa con base en amenazas.Somos un gran vecino. Díganlo si no el millón y medio de estadounidenses que eligieron a nuestro país como hogar, la más grande comunidad de ese origen fuera de EU. Para ellos también somos el mejor vecino que pudieron tener.

Trump has long hammered Mexico over trade, pledging to crack down on what he calls abuses that sap American jobs. His claims about Mexico making money off the United States appear to relate to inaccurate assertions he has repeatedly made about the U.S. trade balance with other countries.

While Trump claims the U.S. having a trade deficit with another country is the same as "losing" money, it simply means America buys more goods from the country than the trading partner purchases from the U.S. In 2017, the U.S. had a $71 billion goods trade deficit with Mexico and a $63.6 billion deficit for both goods and services, according to the U.S. Trade Representative.

In addition, while Mexico admits fewer immigrants than the U.S., it is not clear that Mexico has the strongest or America has the weakest immigration laws in the world, according to PolitiFact.

Trump sees calls to crack down on Mexico as a strong political argument and often intensifies them when looking toward an election. The president faces what will likely be a difficult campaign for re-election next year.

He also threatened to close the southern border last year ahead of the midterm elections. At the time, Trump's rhetoric sparked concerns about economic damage from closing points of entry with a vital trading partner.

States Trump aims to win next year such as Arizona and Texas rely heavily on trade with Mexico.

Neither the White House nor the Department of Homeland Security immediately responded to CNBC's requests to comment on his tweets.

Subscribe to CNBC on YouTube.