Security forces have foiled an attempt by about 1,000 migrants to charge a six-metre tall border fence that separates Morocco from the Spanish-held north African territory of Melilla, Spain's government said.
The migrants organised themselves into lines and approached the Moroccan side of Melilla's border on Tuesday, according to the government representative.
They got close to the fence, but Spanish and Moroccan security forces were able to block their approach.
Authorities said this practice has become common as desperate migrants try to enter the Spanish cities of Melilla and Ceuta.
Both cities, of about 80,000 inhabitants, share the European Union's only land borders with Africa, making them a common target for hopeful migrants.
But several have died trying the cross the border and hundreds of others have made it only to end up in overcrowded immigrant processing centres.
On November 20, Moroccan security forces thwarted another attempt by 1,000 migrants.
Last month, Spain began constructing looming barbed wire fences along Melilla's 11-kilometre border.