WASHINGTON — A sharply divided U.S. Supreme Court on Thursday upheld the centerpiece of President Barack Obama’s signature healthcare overhaul law that requires that most Americans get insurance by 2014 or pay a financial penalty.

“The Affordable Care Act’s requirement that certain individuals pay a financial penalty for not obtaining health insurance may reasonably be characterized as a tax,” Chief Justice John Roberts wrote for the court’s majority in the opinion.

“Because the Constitution permits such a tax, it is not our role to forbid it, or to pass upon its wisdom or fairness,” he concluded. The vote was 5-4.

In another part of the decision and in a blow to the White House, a different majority on the court struck down the provision of the law that requires the states to dramatically expand the Medicaid health insurance program for the poor.

The upholding of the insurance purchase requirement, known as the “individual mandate,” was a major election-year victory for Obama, a historic ruling on the law that aimed to extend coverage to more than 30 million uninsured Americans.

“The court made the right decision in preserving the basic consumer protections in thehealth care reform law — like letting young people stay on their parents’ policies or preventing insurance companies from canceling your coverage when you get sick,” said Rep. Chellie Pingree, D-Maine. “The court did the right thing by ruling in favor of consumers instead of siding with the big insurance companies.”

Rep. Sharon Treat of Hallowell, who’s been closely involved with the issue, says it’s time to put aside politics and implement the law. That sentiment’s echoed by the consumer group Maine People’s Alliance.

Maine Attorney General William Schneider, who joined other states in challenging the law, plans to comment after he reviews the decision.

Maine is one of 26 states that sued to overturn the federal health reform law, challenging as unconstitutional the requirement that nearly all Americans purchase health insurance by 2014 or pay a penalty.

Many of the law’s major provisions take effect in 2014, including a requirement that states set up marketplaces for consumers and businesses to shop for health insurance. The so-called health insurance exchanges have been compared to websites like Travelocity and Orbitz, allowing people to compare health plans much like they do airfare or hotel bookings.

Fifteen states have already set up their exchanges. Maine is one of three states that has decided not to, following a move by Republicans in March to hit the brakes on a state exchange pending the Supreme Court ruling.

The 2010 law constituted the $2.6 trillion U.S. healthcare system’s biggest overhaul in nearly 50 years.

Critics of the law had said it meddles too much in the lives of individuals and in the business of the states.

Twenty-six of the 50 U.S. states and a small business trade group challenged the law in court. The Supreme Court in March heard three days of historic arguments over the law’s fate.

The court’s ruling on the law could figure prominently in the run-up to the Nov. 6 election in which Obama seeks a second four-year term against Republican challenger Mitt Romney, who opposed the law.