Iranian naval vessels have fired what appeared to be warning shots at a Singapore-flagged ship in international waters in the Gulf, prompting it to flee to United Arab Emirates (UAE) waters, US officials said.

The Alpine Eternity, an oil tanker, has safely reached the UAE port of Jebel Ali after coming under attack in the Gulf on Thursday, the ship's manager said.

The UAE sent Coast Guard vessels toward the tanker once it reached UAE waters and the Iranian Revolutionary Guard Corps Navy ships turned away, the Gulf state's news agency said.

A spokesman for the vessel's Norwegian manager Transpetrol said it was attacked at sea at 08:00 GMT while on its way to the UAE port of Fujairah.

"The nature of the attack is still unclear," the spokesman said.

A second US official said there were about five Iranian ships and described the shots as "small arms fire."

The incident came as US President Barack Obama and leaders from Gulf nations met at Camp David in Maryland on Thursday in a rare, high-profile summit on US efforts to broker a nuclear deal with Iran.

Speaking at the summit, Saudi Foreign Minister Adel al-Jubeir said the Iranian navy's actions were a clear violation of international law and that such behaviour must stop.

The US and five other world powers are in talks with Tehran to curb its nuclear programme.

Iran has recently seized a Marshall Islands-flagged vessel in the Gulf and warned the United States not to interfere with an Iranian aid ship headed for Yemen.

The commercial cargo ship was later released, after Iranian officials said a commercial dispute had been settled.

Following the seizure of the Marshall Islands-flagged vessel, the US Navy recently provided security for US-flagged commercial ships crossing through the Strait of Hormuz.

But US commanders called it off after about a week, saying tensions had appeared to ease.