The government of Somalia's Puntland region says the hostages were freed Sunday after a 13-day siege against the ship the pirates had captured, the MV Iceberg 1.
The vessel was near the coastal village of Gara'ad.
Somali pirates captured the MV Iceberg 1 off the coast of Yemen in March 2010 as it headed to the United Arab Emirates.
Puntland says after two years and nine months in captivity, the hostages show signs of physical torture and illness. It says they are now receiving nutrition and medical care.
The crew includes people from Yemen, India, Ghana, Sudan, Pakistan and the Philippines.
In 2010, Somali pirates hijacked nearly 50 ships and received tens of millions of dollars in ransom payments. Hijackings have dropped sharply over the past 18 months, after most ships adopted stronger security, and foreign navies increased their patrols off the Somali coast.