The U.S. Supreme Court on Thursday largely upheld President Obama's health care reforms, validating the Patient Protection and Affordable Care Act's controversial requirement that every American purchase health insurance, even as it recast the provision as a tax on the public.

The ruling shocked opponents of the law, many of whom expected a majority of the justices to at least throw out the individual mandate, if not the entire law.

(View the Supreme Court's ruling)

Whipsawed congressional Republicans immediately scheduled a July 11 House vote to repeal the law, though it will be a largely symbolic gesture since neither the Democratic Senate nor Obama will agree.

"You know, I think the real outcome of today's decision is to strengthen our resolve to make sure that this law is in fact repealed," House Speaker John Boehner, R-Ohio, said.

Obama, looking both elated and relieved, addressed the nation from the White House's ornate East Room shortly after the ruling was announced. He extolled provisions in the law that have grown popular with the public, including the elimination of lifetime limits on coverage, free preventative care and coverage for people with pre-existing conditions.

Left unaddressed by the president was the court's ruling that the law's individual mandate, the requirement that all Americans buy insurance or pay a fine, amounted to a new tax. The administration has repeatedly claimed in debates and court that it was not a tax.

"With today's announcement, it's time for us to move forward, to implement and, where necessary, improve on this law," Obama said.

(See more photos from the Supreme Court)

The court narrowly approved the president's reforms on a 5-4 vote after Chief Justice John Roberts, a Republican appointee, sided with the court's more liberal justices and wrote the majority opinion.

In that opinion, Roberts disputed the administration's claim that Congress could force people to buy insurance because it had the power to regulate interstate commerce. But he upheld the mandate, a central part of the law, saying, "Such legislation is within Congress's power to tax."

Under the law, people who do not buy insurance will be penalized a percentage of their income. About 4 million people are expected to pay an average penalty of $1,000 in 2016 because they didn't buy insurance, most of them middle class who earn less than $59,000 a year, the Congressional Budget Office reported.

The court's ruling was a blow to Republicans, who were hoping the court would rebuke Obama.

But it elated Democrats, who have had very little good news lately as the sour economy and the poll numbers suggest they could face a tough election in November.

When asked about the court's classification of the mandate as a tax, House Minority Leader Nancy Pelosi, responded, "Call it what you will, it is a step forward for America's families. And you know what? Take 'yes' for an answer. This is a very good thing for the American people."

The Cato Institute's Mike Tanner suggested Republicans could still mine political advantage from the ruling, noting that independent voters who will likely prove pivotal in November don't favor new taxes.

"There are a lot of people in the middle who will find this another reason to be cynical and distrustful of government in general, and the Obama administration in particular," Tanner said.