The dissenters said in a joint statement that the law "exceeds federal power both in mandating the purchase of health insurance and in denying non-consenting states all Medicaid funding."
In all, the justices spelled out their views in six opinions totaling 187 pages. Roberts, Kennedy and Ginsburg spent 57 minutes summarizing their views in the packed courtroom.
The legislation passed Congress in early 2010 after a monumental struggle in which all Republicans voted against it. House Majority Leader Eric Cantor, R-Va., said Thursday the House will vote the week of July 9 on whether to repeal the law, though such efforts have virtually no chance in the Democratic-controlled Senate.
GOP presidential candidate Mitt Romney has joined in calls for complete repeal.
After the ruling, Republican campaign strategists said Romney will use it to continue campaigning against "Obamacare" and attacking the president's signature health care program as a tax increase.
"Obama might have his law, but the GOP has a cause," said veteran campaign adviser Terry Holt. "This promises to galvanize Republican support around a repeal of what could well be called the largest tax increase in American history."
Democrats said Romney, who backed an individual health insurance mandate when he was Massachusetts governor, will have a hard time exploiting the ruling.
"Mitt Romney is the intellectual godfather of Obamacare," said Democratic consultant Jim Manley. "The bigger issue is the rising cost of health care, and this bill is designed to deal with it."
More than eight in 10 Americans already have health insurance. But for most of the 50 million who are uninsured, the ruling offers the promise of guaranteed coverage at affordable prices. Lower-income and many middle-class families will be eligible for subsidies to help pay premiums starting in 2014.