National Court judge Fernando Andreu on Tuesday freed the suspects and ordered the destruction of the drugs seized, Spain's La Vanguardia newspaper reported.
The decision comes hot on the heels of Spain's recent scrapping of its universal jurisdiction provisions.
On March 15th, the Spanish Parliament green-lighted controversial legislation which prevents Spanish judges from trying crimes committed outside Spain.
That decision could lead to shelving of high profile international cases including investigations into allegations of Chinese genocide in Tibet in the 1980s and 1990s and US torture at their military prison facility at Cuba's Guantanamo Bay.
In Tuesday's ruling on the drugs case, Andreu said the sailors arrested were not Spanish.
He also noted that their vessel was not carrying a Spanish flag, and the suspects had no intention to commit a crime in Spain as they were headed to Libya when they were captured.
His decision to drop the charges was "in strict accordance with national and international law", Andreu said in his ruling.
The Spanish Government's decision to scrap its universal jurisdiction provisions has come under heavy fire from political opponents.
Spain's ruling conservative Popular Party (PP) argues changes to the country's universal justice regime were needed to avoid "useless disputes that only generate diplomatic conflicts".
But a spokesperson for Spain's leading opposition socialist PSOE party said the government had bowed to Chinese pressure.
In February, a Spanish judge sought international arrest warrants for former Chinese President Jiang Zemin and four other top Chinese officials as part of a probe into alleged genocide in Tibet.
This sparked outrage from China with officials in that country saying they were "strongly dissatisfied and firmly opposed" to the move.
Spain's new legal regime also received its first serious test recently when National Court judge Santiago Pedraz said he would keep investigating the 2003 death of Spanish cameraman José Couso in Iraq.
Couso was one of three journalists killed on April 8th 2003 in Baghdad during the US invasion of the city.
Explaining his ruling, Pedraz said he was obliged to pursue the case under the Fourth Geneva Convention, ratified by Spain, which deals with the protection of civilians during war time.