Spain has deployed troops after record numbers of migrants entered its enclave of Ceuta from neighbouring Morocco.
At least 6,000 people reached Ceuta in a single day, Spanish officials say.
They say the migrants - who include about 1,500 minors - either swam around the border fences that jut out into the sea or walked across at low tide.
Spain's Prime Minister, Pedro Sánchez has vowed to restore order. Spain says it has already sent some 2,700 migrants back - but not the minors.
Most of the migrants are said to be from Morocco.
The Spanish forces troops have been deployed to the beach to help border police at Ceuta's main entry point - Tarajal, on the enclave's south side.
Interior Minister Fernando Grande-Marlaska said 200 troops, plus 200 extra police were going to assist Ceuta's normal 1,100-strong border force. The enclave has some 80,000 inhabitants.
Spain's Ceuta and Melilla enclaves have become magnets for African migrants.
On Tuesday, Moroccan security forces at Fnideq, the adjacent town to Ceuta, fired tear gas to disperse a large crowd of migrants at the border fence, AFP news agency reported.
Mr Sánchez has cancelled a trip to Paris - he was to attend a French-led summit on financial aid for Africa. Instead, he is focusing on the Ceuta crisis, and he promised "maximum firmness" in restoring normality to the enclave.
He has received support from senior EU officials, with European Council President Charles Michel tweeting: "Spain's borders are the European Union's borders."
EU Commissioner for Home Affairs Ylva Johansson described the number of arrivals in Ceuta as "unprecedented" and "worrying", noting that "a big number of them [are] children".
At the other enclave, Melilla, 86 sub-Saharan Africans entered on Tuesday via its southern jetty, which marks the border with Morocco.
Melilla has a formidable border fence, and several hundred more migrants were blocked by security forces, Spain's Efe news agency reports.
Spanish officials quoted by Efe said Moroccan guards had helped the Spanish forces in Melilla. Some migrants threw stones at the Spanish forces, they said.
Spanish media said it was different in Ceuta, where Moroccan border guards stood by and watched as migrants took to the sea to try to reach the enclave.
Most of the migrants were said to be young men, but there were also several families. Many had used inflatable rings and rubber dinghies.
They started arriving in Ceuta at 02:00 (midnight GMT) on Monday, but the number soared during the day. At least one died during the crossing.
Since the 17th Century both Ceuta and Melilla have been under Spanish rule, though they are long claimed by Morocco. The port cities now form the EU's only land border with Africa. They have semi-autonomous status, like some regions of mainland Spain.
The influx comes amid renewed tension over Western Sahara, a territory occupied by Spain until 1975, when Morocco annexed it. Since then it has been disputed between Morocco and the indigenous Sahrawi people, led by the Polisario Front.