Police found the hashish, with an estimated street value of USD 65 million, when they searched a refrigerated truck carrying melons from the Moroccan port of Tangiers.
On its arrival in the southern Spanish port of Algeciras on April 27, police searched the Moroccan-registered truck.
"On opening it, they found melons were being carried in the first two pallets, as the driver stated," said a joint statement by the police and Spain's interior ministry.
A total of 24 boxes were discovered containing 32.38 tonnes of hashish and the driver was arrested on suspicion of committing a crime against public health, police said.
Also Read
The record for Spain dates to 1996 when 36 tonnes of hashish were seized in a boat in the country's southeast, leading to the arrest of 23 people.
But larger hauls have been recorded elsewhere, including notably in June 2008 when Afghan anti-narcotics police seized 237 tonnes of hashish.
Last year, Spain intercepted a total of 325.5 tonnes of hashish, down 8.5 per cent from the year before, the interior ministry said.