The 438 migrants, most of them from sub-Saharan Africa, were given first aid before being taken to the nearest Moroccan port, an officer told the state-run MAP news agency late Monday.
Earlier this month, a merchant ship rescued 33 migrants who had spent two weeks adrift in the Atlantic Ocean en route for the Canary Islands. Fourteen fellow migrants lost their lives.
Migrant arrivals on the Spanish archipelago have surged since late 2019 when increased patrols in the Mediterranean dramatically reduced crossings there.
At its shortest, the sea crossing from the Moroccan coast is around 100 kilometres (65 miles), but strong currents make it very dangerous.
The vessels used are often overcrowded and in poor condition, adding to the risks.
In the first six months of this year, a total of 2,087 migrants died trying to reach Spain, according to Caminando Fronteras, a Spanish NGO that monitors migrant flows.