The dramatic shutdown took place only three days after Trump threatened to close the "whole border" with Mexico if "it gets to a level where we're going to lose control or people are going to start getting hurt."
Border officials in San Diego, California, said on Twitter that they had temporarily closed the San Ysidro crossing point -- one of the busiest between the two countries -- to both vehicular and pedestrian traffic.
The order was lifted some hours later.
Mexican Interior Minister Alfonso Navarrete accused some of the migrants of attempting the Tijuana crossing in a "violent way."
"We are going to act and proceed to their deportation," he told the Milenio television network, adding: "Far from helping the caravan, they are hurting it."
Video clips posted on Twitter showed large numbers of migrants dashing across a shallow concrete waterway toward the border. Several thousand migrants, mostly from Central America, have been gathering in Tijuana in hopes of entering the US.
Secretary of the US Department of Homeland Security (DHS) Kirstjen Nielsen later issued a statement accusing the migrants of seeking to harm border patrol personnel "by throwing projectiles at them."
"As I have continually stated, DHS will not tolerate this type of lawlessness and will not hesitate to shut down ports of entry for security and public safety reasons," she said, adding the US would "seek to prosecute" offenders.
'Are we in the US yet?'
At least 500 migrants, including women and children, had been taking part in a peaceful demonstration in Tijuana before dashing toward the border in an attempt to clamber over a first metal barrier there.
"Are we in the United States yet?" some asked in desperate tones.
Several hundred made it over the first barrier and were trying to cross a second -- topped with spikes -- when US border officers began firing tear gas at them even as US Army helicopters flew low overhead, according to an AFP journalist on the scene.
The migrants tried to protect themselves -- covering their faces, with mothers holding their children close. There were cries of pain, desperation and frustration as the crowd swirled over the border line and back.
Some migrants shouted that they only wanted to make their way to a better life.
But amid the stinging gas, several migrants turned back.
Trump has repeatedly warned that the large group of migrants moving through Mexico toward the US included criminals and possibly terrorists, while providing no evidence to support that.
A reported asylum deal
The US president has deployed some 9,000 troops along the border in support of Customs and Border Protection agents.
Approximately 5,000 migrants reached Tijuana over the past week, after an exhausting trip of up to 2,500 miles (4,000 kilometers) covered in just over a month. Many were fleeing violence and poverty in Honduras in hopes of finding asylum in the US.
To enter the US legally, migrants must formally apply for asylum, but the wait for those requests to be processed can last up to a year.
Trump signed a proclamation earlier this month to prevent anyone filing asylum claims except at legal ports of entry, but a federal judge in San Francisco temporarily blocked the order, pointing to "irreconcilable conflicts" with immigration law.
The Washington Post reported Saturday that the Trump administration had gained the support of Mexico's incoming government for a plan to require asylum seekers to wait in Mexico for their applications to be processed.
But officials in the incoming administration of President-elect Andres Manuel Lopez Obrador said later -- after the Post report was met by stiff criticism in Mexico -- that the agreement was not yet final.
Several hundred made it over a first barrier and were trying to cross a second — topped with spikes — when the US border guards began shooting at them even as US Army helicopters flew low overhead. The border crossing was closed for a few hours.