The port of entry at San Ysidro, north of Tijuana and south of San Diego, had been closed since about 11:30 a.m. Sunday but was reopened by 6 p.m. local time, U.S. Customs and Border Patrol said in a statement.
Thousands of Central American migrants are waiting in Tijuana and surrounding areas to apply for asylum in the U.S.
Tear gas was deployed to disperse the crowd and CBP agents apprehended multiple people who tried to enter illegally, Border Patrol said.
No one was injured, according to statements by CBP and Mexico's Interior Ministry.
Mexico's Foreign Ministry asked U.S. officials on Monday to investigate the use of force of "non-lethal weapons" toward Mexico but highlighted that it aims to maintain close cooperation with the U.S. to handle the thousands of migrants seeking asylum "in a joint manner and with a shared responsibility," according to a statement.
In a tweet Monday morning, Trump put pressure on the Mexican government and the country's new president, Andres Manuel Lopez Obrador, who takes office on Dec. 1, to implement measures to send the asylum-seeking migrants back to their Central American countries.
"Mexico should move the flag waving Migrants, many of whom are stone cold criminals, back to their countries. Do it by plane, do it by bus, do it anyway you want, but they are NOT coming into the U.S.A. We will close the Border permanently if need be. Congress, fund the WALL!" Trump tweeted.
Mexico's Foreign Ministry reiterated Monday that it is committed to continuing to protect human rights and the safety of migrants at all times.
Some demonstrators on the Mexico side of the border "split off to head towards multiple locations along the border," and some attempted to enter the U.S. in areas "directly east and west" of the border crossing, the release stated. Some also attempted to enter the U.S. through northbound and southbound vehicle lanes at the port of entry, but they were "stopped and turned back to Mexico," according to CBP.
The attempts to "illegally enter the U.S." continued and CBP agents responded to them, the agency said.
United States Homeland Security Secretary Kirstjen Nielsen said in a statement that the border was closed "to ensure public safety in response to large numbers of migrants seeking to enter the U.S. illegally."
Some migrants threw "projectiles" at CBP agents, Nielsen said. Some CBP agents were hit by rocks, the agency said.
"After being prevented from entering the Port of Entry, some of these migrants attempted to breach legacy fence infrastructure along the border and sought to harm CBP personnel by throwing projectiles at them,” Nielsen said. "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. We will also seek to prosecute to the fullest extent of the law anyone who destroys federal property, endangers our frontline operators, or violates our nation’s sovereignty."
CBP had deployed additional agents to the border in preparation for multiple planned demonstrations, the agency said. The border was closed "to prepare for the possibility that additional groups would also break off from demonstrations for a possible attempt or attempts to rush illegally through the port of entry," the release stated.
U.S. Military service members were present at the request of CBP and moved some of the barricades at the border, a spokesperson for U.S. Army North told ABC News.
CBP agents, members of the military and federal, state and local law enforcement officers will continue to have a "robust presence" along the Southwest border "to prevent illegal entry or violence," Nielsen said, adding that officials will "continue to stay in close contact with Mexican authorities" to resolve the situation safely.
U.S. Military service members will not be conducting law enforcement functions but are authorized to provide protection for CBP agents "and help make sure CBP personnel can perform their assigned Federal functions," the U.S. Army North said in the statement.
Military police are armed with batons and shields but not pistols, according to officials.
Video taken at the scene shows some migrants running near a canal close to the border, others gathering near an open fence near the border and some walking over a broken fence. One shot shows a migrant who climbed on top of a train holding a Honduran flag.
Mexico's Interior Ministry said federal and state authorities in Baja California were able to contain a group of about 500 migrants trying to cross the border "in a violent way."
The country's National Institute of Migration will "immediately deport" the people who "participated in these violent events," according to the Interior Ministry.
Mexico will not deploy military forces "in accordance with its internal policy of respect for human rights, and the non-criminalization of migration," according to the government's statement. But the government will reinforce the border points that people broke through as they tried to cross over to the U.S., the statement said.
More than 5,000 have been camping out inside a sports complex in Tijuana after arriving at the border city last week, the AP reported.
The number of people in the caravan currently stands at 8,247, according to the Mexican government. More than 7,400 of those migrants are currently located in the state of Baja California in the cities of Mexicali and Tijuana, the Interior Ministry said.
ABC News' Chris Francescani, Joshua Hoyos, Amanda Maile, Elizabeth McLaughlin and Kirit Radia contributed to this report.