The US military sank three boats of Yemeni Houthi rebels who attempted to hijack a container ship in the Red Sea on Sunday.
Four boats tried to attack the Maersk Hangzhou, said the US military, with US forces opening fire in “self defence”.
Three of the boats were sunk, while the fourth boat fled the area.
Nobody on-board the Singapore-flagged Maersk Hangzhou was injured, said a US military spokesperson. The vessel was also found to be sea-worthy.
Houthis rebels have been attacking ships in the Red Sea, a vital shipping lane, since November.
The Iranian-backed group claims its attacks are directed at vessels linked to Israel, in response to the war in Gaza.
"This is the 23rd illegal attack by the Houthis on international shipping since November 19," United States Central Command (CENTCOM) said.
In another statement, it added the attackers had got within 20 metres (65 feet) of the vessel.
Maersk said it had paused sailings through the Red Sea for 48 hours after the attacks.
It had earlier reported coming under missile fire on Saturday, with two missiles shot down by US forces.
British Foreign Secretary David Cameron said he had made clear in a call with Iranian Foreign Minister Hossein Amirabdollahian that Iran shared responsibility for preventing the attacks after the latest incident.
"I made clear that Iran shares responsibility for preventing these attacks, given their long-standing support to the Houthis," he said in a post on social media site X, adding the attacks "threaten innocent lives and the global economy".
On Saturday, the top commander of US naval forces in the Middle East said Houthi rebels have shown no signs of ending their "reckless" attacks on commercial ships in the Red Sea.
This is in spite of a global effort to protect vessels in the vital waterway, which comes as trade traffic begins to pick up.
The Houthis earlier this week also claimed responsibility for a missile attack on a separate container ship, and for an attempt to attack Israel with drones.
MSC Mediterranean Shipping said there were no injuries to its crew from the attack on its ship, the United VIII, on Tuesday. The vessel was en route from Saudi Arabia to Pakistan.
The company said the ship had informed a nearby coalition naval warship that it had come under attack and had taken evasive manoeuvres.