The drug-stuffed fruit was found among 10 shipping containers filled with pineapples that arrived in the southern port of Algeciras, one of Europe's largest ports, the ministry said in a statement.
“Among the thousands of fresh pineapples inside the containers, they found fruit that had been hollowed out and stuffed with drugs and then covered with a yellow wax that simulated the colour of pineapple pulp,” the statement said.
The pineapples arrived from an undisclosed country in Central America and were en route to two companies, one based in Madrid and the other in Sant Quirze del Valles near Barcelona.
Both companies were said to be run by Spanish nationals of Colombian origin.
The police detained three people as part of their investigation and have not ruled out more arrests.
Last year, police in Algeciras seized 2.5 tonnes of cocaine hidden inside a shipment of pineapples arriving from Costa Rica — one of the biggest ever seizures of the drug in Spain.
Spain's close ties to its former colonies in Latin America have made it a key entry point for cocaine smuggled across the Atlantic to Europe.
Smugglers have used increasingly ingenious methods to get the drug 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, consisting of bowls, plates and saucers.