Pirates have released a Cyprus-flagged tanker seized off the West African country of Benin on 15 September with a 23-strong crew, including five Spaniards, a Spanish foreign ministry spokeswoman said Saturday.
"The boat has been freed. I have not been informed of whether anyone was injured or killed in the operation," she said.
The coast of Benin, which neighbours Nigeria, Africa's largest oil producer, has seen a steep increase in hijackings this year, with 19 ships coming under attack.
Of the 19, eight were hijacked, nine were boarded and there were unsuccessful attempts to attack two others, according to the International Maritime Bureau.
In such attacks pirates generally steal fuel or oil being hauled by tankers with the aim of selling it on the region's lucrative black market, the maritime agency says.
Unlike the explosion of piracy off the coast of Somalia on the eastern side of the continent in recent years, those involved in the recent West African attacks have so far not appeared to be after ransom payments.