He was discovered when agents from Spain's Guardia Civil removed the front bumper of the car and found him tied to the inside.
"He was in a very serious condition," a Guardia Civil spokesman told news agency Atlas.
"He was having trouble breathing" and was taken straight to hospital, officials confirmed.
Migrants are resorting to increasingly drastic measures to sneak into Spain.
Story continues below…
An eight-year-old boy was discovered hiding in a suitcase as a woman attemepted to smuggle him into Spain at the border of Spain's north African enclave of Ceuta in May 2015.
Abou, aged 8, was curled up inside a suitcase. Photo: Guardia Civil