It was concealed in the wheelchair of a woman travelling by boat from Ceuta, a tiny Spanish territory in north Africa, to the southern Spanish port of Algeciras, said a statement from the interior ministry on Monday.
The suspect, who was on the same boat, hid the drugs without the woman's knowledge, it added.
It was not immediately clear if the man knew her.
Spain's proximity to north Africa, a major source of hashish, and its close ties with its former colonies in Latin America, a key cocaine producing region, have made it a major gateway into Europe for drug traffickers.
Smugglers often resort to creative methods to get drugs past Spanish customs.
In recent years, police have found cocaine inside breast implants, a wig, hollowed-out pineapples, a plaster cast encasing a man's broken leg as well as inside a 42-piece crockery set.