The International Court of Justice (ICJ) has ordered the US to ease sanctions it re-imposed on Iran after abandoning a nuclear deal in May.
Judges ruled that the US had to remove "any impediments" to the export of humanitarian goods, including food, medicine and aviation safety equipment.
The US argued the ruling was a "defeat" for Iran, saying it already allowed humanitarian-related transactions.
The rulings of the ICJ are binding but the court has no power to enforce them.
It is the main judicial organ of the UN and settles legal disputes between member states. But both nations have in the past ignored the court's rulings.
What were the arguments in court?
Iran said the sanctions violated the 1955 Treaty of Amity, Economic Relations, and Consular Rights between Iran and the US, which grants the ICJ jurisdiction over disputes.
It also said the reasons cited by President Donald Trump for re-imposing the sanctions were unfounded because the International Atomic Energy Agency (IAEA) had repeatedly confirmed that Iran was complying with the terms of the 2015 nuclear accord signed by Tehran and six world powers.
US lawyers argued that the ICJ should not have jurisdiction and that Iran's assertions fell outside the bounds of the treaty.
The ICJ has ruled previously that the 1955 treaty is valid even though it was signed before the 1979 Revolution in Iran, which saw the US-backed shah overthrown and heralded four decades of hostility between the two countries.
How did the ICJ rule?
The 15-judge panel rejected Iran's call for them to order the reinstated US sanctions to be terminated without delay, and for the US to compensate Iran for the revenue losses it has incurred.
But the judges did order the US to "remove, by means of its choosing, any impediments arising from the measures on 8 May to the free exportation to the territory of the Islamic Republic of Iran" of:
- medicines and medical devices
- foodstuffs and agricultural commodities
- spare parts, equipment and services necessary for the safety of civil aviation
A curb on 'economic warfare'?
Analysis by Anna Holligan, BBC News, The Hague
This is essentially the first time international judges have ruled on what's been described as a case of "economic warfare".
It is a provisional measure issued in response to Iran's urgent request ahead of the second round of sanctions scheduled to be reinstated next month.
The decision could encourage European companies, which ceased trading with Iran for fear of falling foul of President Trump, to reconsider their position, specifically those dealing in the humanitarian items outlined by the judges.
How did both sides react?
The Iranian foreign ministry said the decision "vindicates the Islamic Republic of Iran and confirms the illegitimacy and oppressiveness" of US sanctions.
But US Secretary of State Mike Pompeo accused Iran of abusing the ICJ for political ends and said the court had rejected all of its "baseless requests".
"With regard to the aspects of the court's order focusing on potential humanitarian issues, we have been clear," he added.
"Existing exceptions, authorisations and licensing policies for humanitarian-related transactions and safety of flight will remain in effect. The United States has been actively engaged on these issues without regard to any proceeding before the ICJ."
Mr Pompeo announced that the US was terminating the Treaty of Amity, adding: "This is a decision that is, frankly, 39 years overdue."
He also said the US had "solid" evidence that Iran was to blame for recent attacks against the US consulate in the Iraqi city of Basra and the embassy in Baghdad.
"These latest destabilising acts in Iraq are attempts by the Iranian regime to push back on our efforts to constrain its malign behaviour. Clearly, they see our comprehensive pressure campaign as serious and succeeding."
Why did the US abandon the nuclear deal?
The 2015 accord saw the Islamic Republic limit its controversial nuclear activities in return for relief from international sanctions.
But Mr Trump said it had "failed to achieve the fundamental objective of blocking all paths to an Iranian nuclear bomb" and did not deal with Tehran's "malign activities, including its ballistic missile programme and its support for terrorism".
In an attempt to compel Iran to agree to a new accord, the president reinstated sanctions that targeted the Iranian government's purchase of US dollars, Iran's trade in gold and other precious metals, and its automotive sector.
In November, a second batch of potentially more damaging sanctions will be re-imposed on Iran's oil and shipping sectors as well as its central bank.
The other parties to the deal - the UK, France, Germany, China and Russia - have pledged to abide by their commitments. But many firms have pulled out of Iran.