The Trump administration argued last month that Iran's request was an attempt to misuse the court and that the 1955 treaty
The World Court ordered the United States on Wednesday to ensure that sanctions against Iran, due to be tightened next month, do not affect humanitarian aid or civil aviation safety.
Judges at the International Court of Justice handed a victory to Tehran, which had argued that sanctions imposed since May by the administration of US President Donald Trump violate the terms of a 1955 Treaty of Amity between the two countries.
The ruling is likely to have at most limited practical impact on the implementation of sanctions, which Washington is reimposing and tightening after pulling out of the 2015 nuclear deal that Iran signed with world powers.
The court order issued on Wednesday is temporary pending a resolution of Iran's full lawsuit against Washington by the ICJ, something that could take years.
Iran's Foreign Ministry said in a statement "the decision proved once again that the Islamic Republic is right and the US sanctions against people and citizens of our country are illegal and cruel.
“The United States must comply with its international commitments and lift obstacles to Iranian trade,” it added.
The ICJ is the United Nations’ highest court for resolving disputes between nations. Its rulings are binding, but it has no power to enforce them, and both the United States and Iran have ignored them in the past.
The court said assurances offered by Washington to ensure sanctions do not affect humanitarian conditions were "not adequate."
"The court considers that the United States must...remove by means of its choosing any impediment arising from the measures announced on 8 May 2018," said Presiding Judge Abdulqawi Yusuf, reading a summary of a ruling by the 15-member panel of justices.
More sanctions planned
The sanctions may not hurt "exportation to the territory of Iran of goods required for humanitarian needs such as medicines, medical devices and foodstuffs and agricultural commodities as well as goods and services required for the safety of civil aviation," he said.
While US sanctions "in principle" exempt food and medical supplies, the court said "it has become difficult if not impossible for Iran, Iranian nationals and companies to engage in international financial transactions" to purchase such goods.
The Trump administration argued last month that Iran's request was an attempt to misuse the court and that the 1955 treaty specifically ruled out using courts to resolve disputes.
The treaty was signed long before Iran's 1979 Islamic Revolution which turned the two countries into arch-enemies.
US State Department Legal Adviser Jennifer Newstead had said Iran's real quarrel was its frustration over the US pullout from the nuclear pact, under which Tehran restricted its disputed uranium enrichment program under UN monitoring in exchange for a lifting of most international sanctions.
Trump's unilateral move has put it at odds with the other signatories to the deal, including Washington's close European allies Britain, France and Germany as well as Russia and China.
Washington nonetheless plans to pursue a new series of sanctions due to go into effect November 4 aimed at curtailing Iranian oil exports, the lifeblood of its economy.