A Navy unit in the area on a mission to protect merchant ships arrived in just in time to repel the pirates and force them to flee, Fars news agency reported.
The modern-day buccaneers attacked on six speedboats armed with machine guns came after the tanker, but they were forced to withdraw after several hours of conflict.
This was the worst clash between the Iranian Navy and pirates active in the Gulf of Aden.
The Iranian Navy has conducted anti-piracy patrols in the Gulf of Aden since November 2008, when Somali raiders hijacked an Iranian-chartered cargo ship off the coast of Yemen.
The Gulf of Aden, which links the Indian Ocean with the Suez Canal and the Mediterranean Sea, is an important energy corridor, particularly because Persian Gulf oil is shipped to the West via the Suez Canal.