Tuna trawler and crew released amid reports of $3.5m ransom having been paid by Madrid.
Officials could not immediately say how many barrels of oil were on board, but its value would be in the millions of dollars.
Although pirates have successfully hijacked dozens of vessels in the last several years, Sunday’s attack appears to be only the second ever on an oil tanker.
“This is a jackpot to the pirates,” Andrew Mwangura, from the East African Seafarers Assistance organisation in Nairobi, told Al Jazeera.
In November 2008, pirates hijacked the Saudi supertanker Sirius Star, which held two million barrels of oil valued at about $100m.
The tanker was released last January for a reported $3m ransom.
Piracy in the region has increased despite the ramping up of international navies patrolling the Indian Ocean and Gulf of Aden, one of the world’s busiest shipping routes.