The narrow 5-4 ruling was a victory for Obama but also will serve as a rallying issue for Republicans calling for repeal of the Affordable Care Act passed by Democrats in 2010.
An administration official described the White House reaction as elation, while GOP opponents criticized the high court's reasoning and promised an immediate repeal effort.
- What does the health care law mean for Washington state?
- Parents of Mukilteo boy with rare blood disease praise health care ruling
- Local politicians react to high court's healthcare ruling
- Healthcare reform's road to the Supreme Court
- Healthcare Policies
- Michele Bachmann
- Stephen Breyer
See more topics »
"Today's decision was a victory for people all over this country whose lives are more secure because of this law," Obama said in a televised White House statement.
Certain Republican presidential nominee Mitt Romney's campaign reported a fund-raising spike of $300,000 just after the high court's decision was announced, and Romney said defeating Obama in November is the only way to get rid of the law despised by conservatives as a costly expansion of government.
Thursday's decision impacts how Americans get medicine and health care, and also provides new court guidelines on federal power.
The most anticipated Supreme Court ruling in years allows the government to continue implementing the health care law, which doesn't take full effect until 2014. That means popular provisions that prohibit insurers from denying coverage for pre-existing medical conditions and allow parents to keep their children on family policies to the age of 26 will continue.
In the ruling, the high court decided the most controversial provision -- the individual mandate requiring people to have health insurance -- is valid as a tax, even though it is impermissible under the Constitution's commerce clause.
"In this case, however, it is reasonable to construe what Congress has done as increasing taxes on those who have a certain amount of income, but choose to go without health insurance," Chief Justice John Roberts wrote in the majority opinion. "Such legislation is within Congress's power to tax."
He later added: "The federal government does not have the power to order people to buy health insurance. ... The federal government does have the power to impose a tax on those without health insurance."
Roberts joined the high court's liberal wing -- Justices Stephen Breyer, Ruth Bader Ginsburg, Sonia Sotomayor and Elena Kagan -- in upholding the law. Four conservative justices -- Samuel Alito, Antonin Scalia, Anthony Kennedy and Clarence Thomas -- dissented.
"To say that the Individual Mandate merely imposes a tax is not to interpret the statute but to rewrite it," Scalia said in dissent. "Imposing a tax through judicial legislation inverts the constitutional scheme, and places the power to tax in the branch of government least accountable to the citizenry."
The polarizing law, dubbed "Obamacare" by many, is the signature legislation of Obama's time in office.
It helped spur the creation of the conservative tea party movement and will be a centerpiece of the presidential election campaign.
Romney called Obamacare bad policy and a bad law, adding that defeating Obama in November is the only way to get rid of it.
"What the court did not do in its last session, I will do on the first day if elected president of the United States, and that's to repeal Obamacare," he said Thursday after the court's decision was announced.
Obama used the focus on the issue to spell out the benefits of the law that remains unpopular with many Americans. The principle upheld by the high court's ruling is that no American should go bankrupt because of illness, the president said.