The six men have been held in a Spanish jail since November 2012 since being caught by Dutch sailors after they ambushed the Izurdia off the Horn of Africa using AK-47 assault rifles.
Spain's National Court, the country top criminal court, convicted the six of piracy and membership of a criminal group.
In its ruling the court said the six men formed "an assault cell or organised pirate group with material to board and kidnap commercial boats that sailed in the Indian Ocean off the coast of Somalia.
The court said they were part of an organisation, based in Zimbabwe capital Harare, dedicated to enriching itself from assaulting and kidnapping boats in the Horn of Africa.
The court said the six armed men approached the Izurdia on a skiff on October 10, 2012 about 300 nautical miles off the Somali coast.
They aborted their attempted ambush after private security guards on board the Spanish trawler fired shots at them.
A Dutch navy ship taking part in the European Union's anti-piracy operation Atalanta detained them the following day and handed the six men over to Spanish authorities.
A Spanish court in 2013 convicted another six Somalis for piracy and sentenced them to between eight and 12 and a half years in jail for attacking a Spanish warship in 2012 off the coast of Somalia.
In 2011, two Somalis were sentenced in Spain to 439 years in jail each for seizing a Spanish tuna-fishing boat in 2009 and holding its 36 crew members for 47 days.
Under Spanish law, they will serve only a maximum of 30 years in jail, regardless of the sentence.
Maritime piracy by Somalians in the Horn of Africa hit its peak in 2011, but has since waned significantly in the face of stepped-up international naval patrols.