Spanish rescuers located three of the five migrants who were on board the dinghy, one of whom had died, about five nautical miles from Tanger, Morocco.
The two survivors were suffering from severe hypothermia and were taken to Tarifa in southern Spain, rescuers said, adding that the search continued for the missing.
A Moroccan ferry that travels between Tanger and Tarifa had initially spotted the migrants' boat and reported "that five people had fallen into the water," the spokesman said.
A member of the ferry crew died in an apparent attempt to help the migrants.
Attempts by Africans to reach the Spanish coast on makeshift boats and illegally enter Europe happen frequently and have increased in the past few months.
In October, at least 16 illegal migrants were found dead trying to reach Spain from Morocco.
Every year, thousands of Africans risk their lives trying to cross the Mediterranean to Spain in the small flat-bottomed boats known locally as pateras.
Figures from the UN Refugee Agency UNHCR show that 74 people were reported dead or missing while attempting this voyage in 2010 – the last year for which figures are available. In 2009, this number was 127.