TIJUANA, Mexico — A peaceful march by Central American migrants waiting at the southwestern United States border veered out of control on Sunday afternoon, as hundreds of people tried to evade a Mexican police blockade and run toward a giant border crossing that leads into San Diego.

In response, the United States Customs and Border Protection agency shut down the border crossing in both directions and fired tear gas to push back migrants from the border fence. The border was reopened later Sunday evening.

The episode comes at a time of growing tension on both sides of the border and promised to become the newest flash point in the story of a caravan that was the target of President Trump’s anti-immigrant rallying cry during the midterm elections.

Mr. Trump has made preventing caravan members from entering into the United States a signature stance of his administration over the past few weeks and has sent American soldiers to the border, although the United States military was not involved in Sunday’s clash. The images of unrest Sunday will likely provide him with additional ammunition as he tries to keep out the caravan members and other immigrants and refugees fleeing poverty and violence in their homelands.