The man's older brother appears to have tried to smuggle him into Spain by ferry.
The older man, aged 34, legally boarded the ferry linking Melilla, a tiny Spanish territory in north Africa, and Almeria in southern Spain with a car on Sunday, a police spokesperson said.
During the crossing he noticed that his brother was not breathing and alerted the ferry's staff.
Crew members as well as emergency services workers in the port of Almeria tried in vain to resuscitate the man.
Police have charged the man's brother with involuntary manslaughter.
In May police discovered an eight-year-old boy from the Ivory Coast curled up inside a suitcase -- without air vents -- that was being carried across a pedestrian crossing from Morocco into Ceuta, Spain's other north African territory.
A security scanner picture of the boy curled up in the suitcase served as a shocking reminder of the lengths migrants take to try to seek a better life in Europe.
His father, a legal resident in Spain, had tried to smuggle the boy into Spain because his income was too low to request residency papers for his son.
The boy was eventually granted temporary permission to live in Spain with his parents.
Each year, thousands of migrants risk their lives trying to enter Ceuta and Melilla, which have the European Union's only land borders with Africa, to try to enter Europe.
Many migrants try to scramble over the seven-metre fences that separate the Spanish cities from Morocco while others try to swim or sail from shores on the Moroccan side.
Four migrants died on Sunday after trying to swim around a maritime fence separating Ceuta from Morocco, the Moroccan authorities said.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ