Iran, however, took the outcome as vindication.

“The decision proved once again that the Islamic Republic is right and the U.S. sanctions against people and citizens of our country are illegal and cruel,” the Foreign Ministry in Tehran said, according to state media.

During hearings in August, Iran argued that the United States was strangling the country “through naked economic aggression” and was violating the Treaty of Amity signed by the two countries on economic relations and consular rights in 1955, long before Iran’s Islamic revolution turned the them into enemies.

Lawyers for the United States had argued that Iran was misusing the court because it had no jurisdiction in the case since the dispute involves American national security. Rulings by the court, which is based in The Hague and settles disputes between nations, are legally binding, though it has no way of enforcing them. In the past, both the United States and Iran have ignored its rulings.

Peter Hoekstra, the United States ambassador to the Netherlands, echoed the administration’s view, writing on Twitter that the ruling was “a meritless case over which the court has no jurisdiction.”

Wednesday’s decision is not expected to change Washington’s course. Mr. Trump had long scorned the 2015 accord, saying in an address in the White House: “This was a horrible one-sided deal that should have never, ever been made. It didn’t bring calm, it didn’t bring peace, and it never will.”