Thousands of migrants participating in a caravan heading toward the United States woke up on Saturday on a bridge over the Suchiate River that divides the borders of Guatemala and Mexico, waiting to cross into Mexican territory.
Hundreds of federal police stood guard on the Mexican side.
On Friday, members of the caravan of more than 3,000 migrants had burst through a Guatemalan border fence and rushed onto the crossing over the Suchiate River, defying officials' entreaties for an orderly crossing and US President Donald Trump's threats of retaliation.
But they were met by a wall of police with riot shields on the Mexican side of the bridge.
About 50 managed to push their way through before officers unleashed pepper spray and the rest retreated, joining the sea of people on the bridge between both countries.
Police and immigration agents began letting small groups of 10, 20 or 30 people through the gates if they wanted to apply for refugee status.
Once they filed a claim, they were given the option to go to a shelter to spend the night.
As dawn broke Saturday, a large number of migrants awoke amid mounds of rubbish that had already piled up at the crossing and waited to see what the day would hold.
Mexican officials had said those with passports and valid visas - only a tiny minority of those trying to cross - would be let in immediately.
Migrants who want to apply for refuge in Mexico were welcome to do so, they said, but any who decide to cross illegally and are caught will be detained and deported.