Police said in a statement that the female driver of the car became "very nervous and evasive" when they asked her to open the trunk of vehicle after it arrived from Tangiers.
In a video released by police an officer can be seen removing several pillows from the trunk and lifting a black cover to reveal a man dressed in shorts and a t-shirt curled up inside the wheel well.
Police said the man was a Moroccan national. The driver of the car, a Moroccan national who is a legal resident in Spain, was detained.
In August, a 27-year-old Moroccan man suffocated to death while trying to illegally enter Spain hidden inside a suitcase in the trunk of a car that arrived by ferry in Almeria in southern Spain from Melilla, a tiny Spanish territory in north Africa.
In September, two migrants were discovered close to death after being smuggled into Spain from Morocco inside a car engine.