But the court struck down the provision that states lose all of their federal Medicaid funding if they decline to participate in the expansion.
"In this case, the financial 'inducement' Congress has chosen is much more than a 'relatively mild encouragement' -- it is a gun to the head," chief Justice John Roberts wrote in the majority opinion.
Political positioning by both parties began shortly after release of the opinion Thursday around 10 a.m.
In a statement released by his campaign, Republican presidential candidate Mitt Romney repeated his promise to work to repeal the law if he is elected.
"Obamacare was bad policy yesterday; it is bad policy today," Romney said. "Obamacare is a job killer. Businesses across the country have been asked what the impact is of Obamacare. Three quarters of those surveyed...said Obamacare makes it less likely for them to hire people."
Sen. Bob Casey (D., Pa.), praised the decision, saying it preserves aspects of the law that expand coverage and protect Americans from the loss of insurance.
"The fact that the law was upheld means that Pennsylvanians will not lose their coverage under a parent's plan and older Americans will not have to face dramatic increases in prescription drug costs," he said in a statement released by his Washington office.
Proponents of the requirement that all Americans who can afford it buy insurance - the individual mandate, as it is known in the law - had based their argument on the Commerce Clause of the constitution, which gives the federal government broad power to regulate interstate commerce.
Since health care is a national market, they argued, the government had the power to require citizens to purchase health coverage.
The majority rejected that, contending that Congress does not, under the commerce clause, have the authority to require citizens to purchase something that they otherwise would not have. But he found that the penalty on persons who failed to obtain insurance was essentially a tax, and that Congress has the authority to impose it. The penalty was included in the law at the behest of health insurers, who said it would serve as an inducement to purchase purchase health insurance.
Roberts, a Bush appointee, was joined in the opinion by justice Elena Kagan, Stephen Breyer, Sonia Sotomayor and Ruth Bader Ginsburg, all appointed by Democratic presidents. Justices Antonin Scalia, Clarence Thomas, Samuel Alito and Anthony Kennedy, appointed by Republican presidents, said they would have struck down the law.
Much attention has focused on the so-called individual mandate. But in its broad sweep, the law also fundamentally restructured and expanded the government's Medicaid health care program for the poor.
Medicaid for decades has been a health care benefit available only to people with incomes below the federal poverty line. States were given wide latitude in designing benefits and to some extent determining eligibility.
The Patient Protection and Affordable Care Act, greatly expanded the size of the program, by raising income levels. The law calls for the federal government to pay for all the cost of the expansion, apart from additional administrative outlays, for several years. The state share of the cost of the expansion will increase to 10 percent by 2020.
The 26 states that challenged the law called the Medicaid expansion "coercive" because they risked losing all of their Medicaid funding if they declined to accept the expansion.
They argued that in these tight fiscal times, the additional costs of the program simply were not affordable.
The majority, while allowing aspects of the Medicaid expansion to stand, agreed with much of the states' arguments, casting an air of uncertainty over a significant portion of the president's health care overhaul.
Roberts said that a provision in the law calling for the withdrawal of all federal Medicaid funds for states that decline to participate in the expansion could have catastrophic budget consequences since the federal contribution to existing state Medicaid programs accounts for 10 percent of state budgets.
"The threatened loss of over 10 percent of a state's overall budget. . . is an economic dragooning that leaves the states with no real option but to acquiesce," Roberts wrote.
The Affordable Care Act won final passage March 21, 2010, after months of partisan debate. It passed without a single Republican vote.
The intricately designed law hinges on multiple components. Most prominent is a requirement that individuals who are not exempted purchase insurance or be subject to a penalty levied by the IRS, gradually increasing over a period of several years until it reached a maximum of $700. Congress included the individual mandate at the request of health insurers.
They argued that the mandate was necessary to compel millions of relatively young and healthy individuals to purchase insurance, to help offset the cost of insuring persons with preexisting ailments that the act required them to cover.
Estimates of the state's additional annuall outlays have ranged from $20 billion to more than $40 billion. The states seeking to block enactment of the ACA have argued that, given the ever tightening financing pressures they face, they would be unable to bear that additional burden.
After the individual mandate itself, perhaps the most pivotal and debated issue was whether the entire act must be thrown out if the requirement to purchase insurance was found unconstitutional.