In a 6-2 decision, the court upheld a ruling in favor of relatives of the 241 US Marines and other American service members who died in the 1983 bombing of barracks in Beirut, and other attacks blamed on Iran.
More than 1,000 Americans are affected by the decision.
Justice Ruth Bader Ginsburg wrote the court's opinion rejecting the Iranian central bank's efforts to block payments to relatives of the victims.
Iran argued the law was unconstitutional as it violated separation of powers, with lawmakers ordering a particular result in a legal case, but a federal court rejected that claim and backed the law.
Also Read
The Supreme Court agreed with the lower court.
The 2012 law "does not transgress constraints the Constitution places on Congress and the president," Ginsburg said in delivering the majority opinion from the bench.
Chief Justice John Roberts filed a dissenting opinion, in which Justice Sonia Sotomayor joined.
Several months before signing the 2012 bill into law, Obama had also signed an executive order freezing all Iranian assets, potentially freeing them up for seizure.
At the time, he pointed to the "deceptive practices of the Central Bank of Iran and other Iranian banks."
The case before the court had marked a rare alliance between Obama and both houses of Congress, which are controlled by his Republican foes.
That leaves the court short-handed and evenly split between justices who lean conservative and those who tend to back liberal positions.
Since Scalia's death, the top court has already deadlocked in three opinions, meaning their rulings set no new national precedents and leave lower court rulings intact.