Trump administration officials claimed the tactic came in response to a "violent mob" attempting to climb a border fence while attacking agents with projectiles – the latter of which has been disputed by eyewitnesses.
More than 150 Central American migrants approached an area of the border in Tijuana in the hope that security measures might be relaxed due to the New Year's holiday.
Children were passed over the razor wire along the fencing to the US side.
Clouds of tear gas could be seen near to the border fence and one migrant picked up a canister and threw it back over the barricade.
US Customs and Border Protection (CBP) said in a statement the gas was aimed upwind of people throwing rocks on the Mexican side who obstructed agents from helping children being passed over razor wire.
The CBP statement said agents had not directly targeted the migrants attempting to cross the fence with gas and pepper spray.
It added that most of the migrants attempting to cross returned to Mexico while 25 people, including two teenagers, were detained.
US Department of Homeland Security spokeswoman Katie Waldman called the group "a violent mob" and said they had thrown projectiles at agents who responded with "the minimum force necessary to defend themselves".
She added: "Congress needs to fully fund the border wall."
Tijuana, a busy crossing between southern California and Mexico, has become a flashpoint in the debate over US immigration policy.
Tensions have intensified by the recent deaths of two migrant children in US custody and a partial US government shutdown over Donald Trump's demand for $5bn (£4bn) in funding for a wall along the border with Mexico.
A spokesperson for Mexico's foreign ministry did not immediately respond to a request for comment.
Agencies contributed to this report