The Supreme Court on Thursday upheld one of the main tenets of President Barack Obama's health care law, ruling 6-3 that millions of Americans are entitled to keep the tax subsidies that help them afford insurance.

Chief Justice John Roberts wrote the court's majority opinion and was joined by Justices Anthony Kennedy, Ruth Bader Ginsburg, Stephen Breyer, Sonia Sotomayor and Elena Kagan.

The ruling, the second case in which the justices have decided in favor of the Affordable Care Act, preserves benefits for an estimated 6.4 million Americans and deals a crippling blow to the law's Republican opponents, who have attempted to undermine it since its passage in 2010.

King v. Burwell centered on whether plaintiffs' arguments that middle- and low-income adults who purchased health insurance through the federally run Healthcare.gov marketplace were entitled to subsidies based on the language of the law that says tax credits are only to be distributed for marketplaces "established by the state."

The law's architects countered that subsidies were always meant to be distributed through both channels, and that the goal of the law was to cover all Americans. The Supreme Court agreed.

Acknowledging plaintiffs' contention that the language in the statute is "ambiguous," Roberts nevertheless said their interpretation of the law "would destabilize the individual insurance market in any State with a Federal Exchange, and likely create the very ‘death spirals’ that Congress designed the Act to avoid.”

“The combination of no tax credits and an ineffective coverage requirement could well push a State’s individual insurance market into a death spiral," the chief justice wrote. "It is implausible that Congress meant the Act to operate in this manner. Congress made the guaranteed issue and community rating requirements applicable in every State in the Nation. But those requirements only work when combined with the coverage requirement and the tax credits. So it stands to reason that Congress meant for those provisions to apply in every State as well."

In dissenting, Justice Antonin Scalia – joined by Justices Samuel Alito and Clarence Thomas – said the majority erred in reading the law’s language describing an “Exchange established by the State” to mean “Exchanges established by the State or the Federal Government.”

“That is of course quite absurd, and the Court’s 21 pages of explanation make it no less so,” Scalia wrote in his own 21-page opinion.

“Words no longer have meaning if an Exchange that is not established by a State is ‘established by the State,’" he said. "It is hard to come up with a clearer way to limit tax credits to state Exchanges than to use the words ‘established by the State.’ And it is hard to come up with a reason to include the words ‘by the State’ other than the purpose of limiting credits to state Exchanges.”

After the ruling, people stood and cheered on the court's steps, holding up signs of states that would have been affected if the subsidies had been struck down and showing how many people would be keeping their insurance because they were not.

The decision comes after the high court in 2012, in deciding National Federation of Independent Business v. Sebelius, found that the so-called "individual mandate," the portion of the law that required Americans to buy health insurance or pay a penalty, was constitutional.

The administration appeared to project confidence about the outcome as the country waited for the ruling. After its release, Obama delivered a statement at the White House praising the court's decision and extolling the benefits of the law, proclaiming that “the Affordable Care Act is here to stay.”

“Today is a victory for hardworking Americans all across this country whose lives will continue to become more secure in a changing economy because of this law,” he said.

Obama also dismissed opponents of the law, reinforcing his expectation that the court’s decision should serve as an end to the political debate over his reforms.

“The point is this is not an abstract thing anymore. This is not a set of political talking points – this is reality,” he said, expressing his ongoing commitment to improve access to healthcare. “So we’ve got more work to do. But what we’re not going to do is unravel what has now been woven into the fabric of America.”