The Guardia Civil police force said it made the arrests after agents in November found 7 kilos (15.4 pounds) of cocaine stuffed inside 57 fake bananas in a shipment of real bananas that arrived from South America in the Mediterranean port of Valencia.
The authorities found another 10 kilos of cocaine hidden inside the flaps of the cardboard boxes that carried the real bananas, a statement said.
Police arrested two Spanish men on suspicion of drug smuggling and of being part of an organised crime group. They are investigating a third man, an Italian.
Spain's close ties with its former colonies in Latin America have made it the main entry point used by drug smugglers to bring cocaine into Europe.
Smugglers have used increasingly ingenious methods to get the drugs past Spanish customs.
In recent years police have found cocaine inside breast implants, a wig, a plaster cast encasing a man's broken leg as well as inside a 42-piece crockery set.