WASHINGTON — After spending 444 days in captivity, and more than 30 years seeking restitution, the Americans taken hostage at the United States Embassy in Tehran in 1979 have finally won compensation.

Buried in the huge spending bill signed into law last Friday are provisions that would give each of the 53 hostages or their estates up to $4.4 million. Victims of other state-sponsored terrorist attacks such as the 1998 American Embassy bombings in East Africa would also be eligible for benefits under the law.

“I had to pull over to the side of the road, and I basically cried,” said Rodney V. Sickmann, who was a Marine sergeant working as a guard at the embassy in Tehran when he was seized along with the other Americans by a mob that overran the compound on Nov. 4, 1979. “It has been 36 years, one month, 14 days, obviously, until President Obama signed the actual bill, until Iran was held accountable,” he said.

The law now stands to bring closure to an episode that riveted the nation and ruptured America’s ties with Iran. The very agreement that won the hostages’ release in 1981 barred them from seeking restitution. Their legal claims were repeatedly blocked in the courts, including an appeal denied by the Supreme Court. Congress tried but failed to pass laws granting them relief.