The man also had cocaine hidden in six beer cans that had been emptied, packed with drugs and resealed, and inside the legs of two small folding stools, police said.
Altogether, he was carrying about 5 kilograms (11 pounds) of the drug, police said.
The man was arrested Wednesday at Barcelona's El Prat airport after arriving from Santiago, Chile.
His left shin was broken, and investigators do not rule out the possibility that the injury was inflicted intentionally so he could smuggle with the cocaine cast.
Spain is a major European gateway for cocaine from Latin America and airport officials pay especially close attention to passengers on flights from Peru, Colombia and Chile, police spokesman Jose Antonio Nin said.
Nin said he knew of cases in which smugglers had concealed cocaine underneath casts but this was the first time officials had seen a cast made entirely of compressed cocaine. It weighed about a kilogram (2.2 pounds), he said.
Police detected the drug by spraying the cast with a chemical that turns bright blue when it comes in contact with cocaine, Nin said. The man was taken to a hospital after the cast was removed.