The NATO Shipping Centre (NSC) said the unnamed ship reported being shot at twice from close range.
The assailants were in a speedboat and were carrying machine guns.
Attacks along the key oil shipping lane are uncommon.
This one happened on the Gulf of Oman side, Reuters reported.
The International Maritime Bureau (IMB) said: “Six persons in a skiff armed with machine gun approached a tanker underway and fired twice towards the accommodation and bridge."
The master raised the alarm and mustered all crew. A fire pump was activated and the vessel altered course.
The attack was aborted when the pirates heard the alarm, IMB added.
The US Navy Maritime Liaison Office named the vessel as the 106,000-dwtAlbum (built 2003),
operated by Arab Maritime Petroleum Transport Co (AMPTC) of Kuwait.
The incident came 90 minutes after another ship was approached by two different speedboats containing men in military clothing, 30 miles from the subsequent incident.
"Two green colored skiffs with three-four persons on board in military clothing...got to 150 metres of a merchant vessel," the NSC said. "After a while the skiffs turned away to Iranian coast."
NATO is investigating both attacks and has yet to determine the nationalities of the men involved.