At least 1,000 migrants have tried to storm the border fence between Morocco and the Spanish enclave of Melilla, officials say.
Some 400 migrants – from sub-Saharan African countries – are thought to have successfully scaled the fence, which divides Africa from Europe.
Melilla is a major crossing point for those seeking work or asylum in Europe.
On numerous occasions in recent months, large groups have attempted to storm the 6m-high (19ft) border fence.
Together with a second Spanish enclave, Ceuta, Melilla is the European Union’s only land border with Africa.
Many of those making the dangerous journey come from Eritrea and Somalia.
The BBC’s Tom Burridge in Madrid says that Spain has recently invested more resources on the border to try to keep the migrants out.
But on Wednesday before dawn some 400 people made it into Melilla, defying efforts by Moroccan and Spanish police to beat them back, Melilla’s Mayor Juan Jose Imbroda said.
Our correspondent says that they will now stay at a temporary immigration centre in the Spanish territory, which is currently accommodating five times the number of people it was meant to house.
The migrants are now likely to spend months – even years – in limbo in Melilla, our correspondent says.
Some will probably be transferred to other centres on the Spanish mainland, but Spain says most will eventually be returned to the countries from which they originated.
In February at least 300 African migrants stormed the border fence, leading to clashes with Moroccan security forces.
Ninety-six migrants at that time were arrested while about 100 managed to cross over, officials said.