Most of the migrants came from African nations, but also included an Afghan and a Yemeni, the Maghreb Arab Press (MAP) reported, adding that they were brought "safely" to shore.
"Navy coast guards on maritime patrol in the Mediterranean and the Atlantic, rescued... 257 people attempting irregular migration, having attempted a perilous crossing aboard makeshift boats, kayaks and even swimming," said the unnamed military official, quoted by MAP news agency.
Last month, at least 23 migrants died trying to climb border fences into the Spanish enclave of Melilla on Morocco's Mediterranean coast. Non-governmental organizations say at least 37 migrants died, a toll higher than the official figure.
Migrants, often fleeing violence and food insecurity at home, have also continued to try to reach Spain by boat.
More than 40,000 migrants, mostly from Morocco, arrived in Spain in 2021 by sea, according to the Spanish Interior Ministry.
Over the first five months of 2022, arrivals increased by 12% compared to 2021, it said. But the normalization of diplomatic relations between Spain and Morocco has led to a decrease in recent weeks.