Prime Minister Jose Luis Rodriguez Zapatero did not mention whether ransom was paid to free the 36 crew members of the Alakrana, but a source told a CNN sister station money was paid, CNN reported.
"Our sailors of the Alakrana are free and will come home," Zapatero said during a news conference. "These tough weeks have ended in a very positive way."
Pirates took over the Alakrana last month. A day later, Spanish military monitoring the situation captured two suspects as they left the fishing boat, then brought them to Madrid.
A Spanish judge indicted the two Somalis in Madrid Monday on 36 counts of kidnapping, one for each of the crew members held.
Pirates have captured more than 50 ships this year off the Somali coast, Spanish Defense Minister Carme Chacon said.
Celebrity Families of 2014 [PHOTOS]