Francisco Jerez, spokesman for the Interior Ministry's office in Almeria, said the 27-year-old man was found late Sunday when his brother sought medical help for him just before the ferry arrived in the southern Spanish port.
Jerez added that the brother, a Moroccan with a French passport, was arrested.
The ferry had come from Melilla, one of two Spanish port city enclaves in northwestern Africa that are bordered by Morocco and the Mediterranean Sea and represent the only land route between Africa and Europe.
Thousands of migrants from Morocco try to enter the European Union illegally via Spain each year, especially through the enclaves.
On Sunday, Morocco's Interior Ministry said four migrants from sub-Saharan Africa drowned while trying to swim around a fence from the mainland to the second enclave, Ceuta.
The statement added that three others were rescued by the Moroccan navy.