"This is a meritless case over which the court has no jurisdiction," US ambassador to the Netherlands Pete Hoekstra said after the ruling at UN's top court.
Hoekstra added that ICJ had "declined to grant the sweeping measures requested by Iran" and it was "a narrow decision on a very limited range of sectors."
"The court considers that the United States, in accordance with its obligations under the 1955 treaty must remove by means of its choosing any impediment arising from the measures announced on 8 May 2018 to the free exportation to the territory of Iran of goods required for humanitarian needs," the ICJ said.
The world court called for US sanctions exception on "medicines and medical devices, food stuff and agricultural commodities as well as goods and services required for the safety of civil aviation such as spare parts, equipment and associated services necessary for civil aircraft."
"In its opinion, the measures adopted by the United States have the potential to endanger civil aviation safety in Iran and the lives of its users to the extent that they prevent Iranian airlines from acquiring spare parts and other necessary equipment as well as from accessing associated services necessary for civil aircraft," it added.
"Unanimously both parties shall refrain from any action which might aggravate or extend the dispute before the court or make it more difficult to resolve," the UN court ordered.
Iran called the ruling a "clear sign" that "Iran is in the right".
The ruling by the International Court of Justice "once again shows that the US government... is day by day becoming more isolated," Iran's forign ministry said in a statement.
The UN's top court gave its judgement after Iran had filed a case against the US for imposing sanctions against it. Iran said the sanctions violated the 1955 Treaty of Amity. The US had argued that Iran was misusing the international court.
The 1955 treaty was signed before Iran's 1979 Islamic Revolution after which US relations with Iran deterioted.