Police launched their investigation when they detected a helicopter flying at "a very low altitude and without any lights" from Morocco to southern Spain, they said in a statement.
Officers seized the helicopter after it landed in a farm in the Los Alcornocales National Park and arrested the pilot, co-pilot and a third man who was helping offload the drugs from the aircraft.
"The pilot of the helicopter, a Ukrainian national, worked in his country as a pilot of helicopters used to put out wildfires and had extensive experience with night flights," the statement said.
Police found 615 kilos (1,355 pounds) of hashish inside the helicopter. They then arrested 17 other suspected members of the ring which police said had "several farms and warehouses where they hid helicopters".
Police found a helicopter that had been damaged in an accident buried several metres below ground in one of the farms used by the ring.
The ring used Alouette II helicopters which can normally fit four passengers but would remove the back seats of the aircraft to fit more drugs in each flight.
Spain's proximity to North Africa, a key source of cannabis, and its close ties with former colonies in Latin America, the world's main cocaine-producing region, have made it a gateway into Europe for drug consignments.
Spanish police seized around 100 tonnes of hashish last year, about three percent less than in the previous year.