Only 23 seconds warning was given before the weapons were fired, according to U.S. Navy Cmdr. Kyle Raines, a spokesman for U.S. Central Command.
The rockets were not fired at the Truman and other ships, and there were no direct communications between U.S. and Iranian navies, military officials said.
“The IRGCN’s actions were highly provocative,” Cmdr. Kevin Stephens, spokesman for the U.S. Fifth Fleet, said Wednesday in a statement.
“Firing weapons so close to passing coalition ships and commercial traffic within an internationally recognized maritime traffic lane is unsafe, unprofessional, and inconsistent with international maritime law.”
Iran’s navy conducted rocket tests last week near US warships and other commercial vessels in the Strait of Hormuz, the American military has said.
The tests threaten to cause new tensions between the two nations following their landmark nuclear deal.
Iran fired “several unguided rockets” about 1,370m (1,500 yards) from two US vessels and a French frigate, US military spokesman Kyle Raines said.
The tests were “highly provocative”, said Cmdr Raines.
The Strait of Hormuz is a narrow waterway between Iran and Oman that provides passage for nearly a third of all oil traded by sea. The strait is also crucial for ships taking part in the war against so-called Islamic State.
In 2012 Iran threatened to block the strait, which lies at the entrance of the Gulf and is 33km (21 miles) wide at its narrowest point.
The latest incident, which took place on Saturday according to the US, follows a series of weapons tests by the Islamic Republic. Iranian media and officials did not immediately comment on the reports.
Iranian ships announced over maritime radio their intention to carry out the test 23 minutes before the rockets were fired.
“Firing weapons so close to passing coalition ships and commercial traffic within an internationally recognised maritime traffic lane is unsafe, unprofessional and inconsistent with international maritime law,” Cmdr Raines said.
The US Navy’s 5th Fleet is based in nearby Bahrain. It conducts anti-piracy patrols in the Gulf and serves as a regional counterbalance to Iran.
Iran signed a long-term deal with six world powers in July to limit its sensitive nuclear activities in return for the lifting of crippling sanctions.
However, this year it has also broadcast footage of a missile attack on a mock-up of an US aircraft carrier and aired film on state TV of an underground missile base.
The Strait of Hormuz was the scene of a battle between the US and Iran in April 1988, when the US attacked two Iranian oil platforms used for surveillance and sank or damaged six of its vessels, including two naval frigates.
Tensions had erupted after the near-sinking of missile frigate USS Samuel B Roberts by an Iranian mine.
In July 1988, the USS Vincennes was patrolling the strait when it shot down an Iran Air flight heading to Dubai, killing 290 people on board. The ship’s crew apparently mistook the plane for an Iranian F-14 fighter.