Officials say a US Navy ship fired warning shots when an Iranian vessel in the Gulf came within 150 yards (137m) on Tuesday in the first such incident since President Donald Trump took office.