Police said that on Sunday evening, the man’s brother had driven his car onto the ferry travelling from the north African Spanish enclave of Melilla to Almeria on the mainland, news agency EFE reported on Monday.
Inside the car was a suitcase carrying the 27-year-old north African immigrant. When his 34-year-old brother disembarked as they reached Almerica, he alerted authorities that something was wrong with his younger sibling.
Emergency services found the man inside the suitcase and tried to revive him, but he was already dead after having spent the entire five-hour journey inside the luggage.
Local media reported that the ferry was operated by the Trasmediterránea company.
Stories of migrants going to extreme lengths to reach Europe have grabbed national attention, highlighting the plight and desperation of those fleeing often violent situations in their homelands.
The story of an eight-year-old boy who hid inside a suitcase to pass border controls to reach his family in Spain struck an emotional chord earlier this year.
The boy, Adou, was ultimately reunited with his mother and father in June, while his father faces charges for the smuggling attempt.
Many migrants seek to cross into the country through Spain's two north African territories, Melilla and Ceuta, which are also Europe's only land border with Africa.
Spain has also complained about EU plans to more evenly distribute asylum seekers across the countries through a quota system, saying Spain already makes great efforts to control African migration.
The country rejected the compulsory quota plan during a summit in Brussels last month, saying Spain would only take in one-third of the number of people agreed upon on the plan.
Tens of thousands have attempted to cross the Mediterranean Sea to reach Europe this year and many have died making the perilous journey.