Police stopped more than 1 600 migrants trying to cross the border from Morocco into the Spanish territory of Ceuta on Tuesday, an official said.
The migrants were the latest in a tide of desperate people trying to breach the frontiers with Ceuta and Melilla, Spanish-held cities perched on the north African coast.
Hundreds of people have managed to cross the borders in recent months but scores have been injured in the attempt and at least 14 drowned last month while trying to swim to Ceuta.
In the latest attempt, hundreds of migrants approached the Tarajal border crossing to Ceuta at dawn and others tried to scale the high fence at another nearby point, a government official in Ceuta told AFP.
“The Moroccan security forces and the (Spanish) civil guard coordinated to stop them entering,” said the official, who asked not to be named.
“None managed to cross,” the official said. One group turned back after seeing that others had failed to make it across, he added, without giving further details.
Across the Strait of Gibraltar from mainland Spain and surrounded by Moroccan territory, the coastal cities of Melilla and Ceuta have the European Union's only land borders with Africa.
They are seen as stepping stones for African migrants desperate to reach Europe.
At least 14 migrants drowned in Moroccan waters on February 6 while trying to swim to Ceuta from a nearby beach after several hundred also tried to storm the land border.
In that incident, Spanish security forces were accused by human rights groups and witnesses of firing rubber bullets at the immigrants.
The ministry said civil guards did fire rubber bullets during the attempt on Ceuta, but denied that contributed to the drownings.
On Friday, more than 200 migrants stormed across a triple-layer border fence into Spain's other north African territory, Melilla, in what Spanish authorities said was one of the largest such crossings in years.