The Greek-owned MV Irene was seized in April.
Somali pirates have released a Greek-owned ship hijacked five months ago and freed its 21 Filipino crew members, officials and pirates have said.
"The MV Irene is free. All 21 crew are safe and sound," maritime official Andrew Mwangura told AFP news agency.
Reuters news agency cited a pirate as saying the hijackers acted after receiving a ransom of $2m (£1.2m).
Pirate attacks have been common off the Somali coast, and international navies have been deployed to counter them.
Somalia has been without a functioning central government since 1991, allowing the pirates to operate in the Gulf of Aden, one of the world's busiest shipping lanes.
The pirate who confirmed to Reuters that the MV Irene had been released on Monday was speaking from the coastal pirate stronghold of Eyl and gave his name as Hussein.
"We already left the vessel and now we are dividing our money," he said. "A helicopter brought the cash this morning."