Iranian authorities said Maersk's cargo ship was given permission to leave after the Danish group, which chartered the Marshall Islands-flagged vessel, promised to abide by an Iranian court decision.
"After obtaining judicial authorisation, the ship was released on May 7," Iran's Ports and Maritime Organisation said in a statement.
The seizure was in connection with an Iranian court order for Maersk to pay $3.6 million (3.2 million euros) in damages to Iranian firm Pars Oil Products Talayieh over cargo that allegedly was not delivered.
The move caused concern for the security of shipping lanes in the strategic strait and prompted the United States to send vessels to monitor the situation.
In a sign of reduced tensions, the Pentagon said Wednesday that the US Navy had halted a mission to accompany American-flagged vessels passing through the Strait of Hormuz.
US warships will however remain in the area to conduct "routine maritime security operations," spokesman Colonel Steven Warren told reporters.
On Wednesday Tehran denied it had detained the ship's 24 crew members, saying they were benefiting from diplomatic assistance.
Iranian state TV reported that the crew members were from Bulgaria, Myanmar, Romania and Britain. There were no Danes on board.