Chief Justice John Roberts wrote the majority opinion, which said that the Commerce Clause of the Constitution does not give Congress the authority to require people to have health care, but that other parts of the Constitution did.
The court's ruling upheld the law's central provision -- a requirement that all people have health insurance.
The importance of the decision cannot be overstated: It will have an immediate and long-term impact on all Americans, both in how they get medicine and health care, and also in vast, yet-unknown areas of "commerce."
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 is likely to be a centerpiece of the presidential election campaign.
Both Obama and his presumptive Republican challenger, Mitt Romney, have been firing up supporters this week by staking out their positions.
Speaking to supporters in Atlanta Tuesday, Obama defended his health care law as the way forward for the American people.
"They understand we don't need to re-fight this battle over health care," he said. "It's the right thing to do that we've got 3 million young people who are on their parent's health insurance plans that didn't have it before. It's the right thing to do to give seniors discounts on their prescription drugs. It's the right thing to do to give 30 million Americans health insurance that didn't have it before."
Romney told supporters in Virginia the same day: "If Obamacare is not deemed constitutional, then the first three and a half years of this president's term will have been wasted on something that has not helped the American people."
Romney, whose opposition to the law has been a rallying cry on the stump, continued: "If it is deemed to stand, then I'll tell you one thing. Then we'll have to have a president -- and I'm that one -- that's gonna get rid of Obamacare. We're gonna stop it on day one."
According to a poll released Tuesday, 37% of Americans said they would be pleased if the health care law was deemed unconstitutional by the Supreme Court.
Twenty-eight percent would be pleased if the Affordable Care Act is ruled constitutional, the NBC News/Wall Street Journal survey showed, compared to 35% who said they would be disappointed if the court came back with that outcome.
But nearly four in 10 Americans surveyed said they would have "mixed feelings" if the justices struck down the whole law. The survey of 1,000 adults was conducted June 20-24.
Previous surveys have indicated that some who oppose the law do so because they think it doesn't go far enough.
The Supreme Court heard three days of politically charged hearings in March on the law formally known as the Patient Protection and Affordable Care Act. The landmark but controversial measure was passed by congressional Democrats despite pitched Republican opposition.
The challenge focused primarily on the law's requirement that most Americans have health insurance or pay a fine.
Supporters of the plan argued the "individual mandate" is necessary for the system to work, while critics argued it is an unconstitutional intrusion on individual freedom.
Four different federal appeals courts heard challenges to parts of the law before the Supreme Court ruling, and came up with three different results.
Courts in Cincinnati and Washington voted to uphold the law, while the appeals court in Atlanta struck down the individual mandate.