WASHINGTON — The House approved Republican legislation Friday that would erase key components of President Barack Obama’s health care law, block federal payments to Planned Parenthood — and earn a certain veto should it reach the White House.

Lawmakers used a near party-line 240-189 vote to approve the bill, which aims squarely at two favorite targets of conservatives. And though they know a veto awaits the measure should it win final congressional approval from the Senate, they say Obama’s rejection would help them sharpen political differences with Democrats for next year’s elections.

“If he vetoes it, I think it will crystallize to the country that the only component missing now is a Republican president, and it shows even more importantly why we need to get a Republican president in the White House,” House Majority Whip Steve Scalise, R-La., said in an interview.

Democrats called the debate a political charade and a waste of time, saying the House has voted 61 times to repeal all or part of Obama’s prized health overhaul since the GOP took control of the chamber in 2011.

“This is a hyper-partisan document that is just talking points for extremists,” said Rep. Ted Lieu, D-Calif.

Republicans wrapped the legislation in a streamlined procedure that would shield it from a Democratic Senate filibuster — meaning it will need only 51 votes to pass that chamber. Filibusters, or procedural delays aimed at killing legislation, take 60 votes to halt and there are just 54 GOP senators.

But even attaining a simple Senate majority for the measure may be tough for Republicans. The bill faces potential opposition there from moderate Republicans concerned it goes too far and conservative GOP senators running for president saying it doesn’t go far enough.

In fact, there were rumblings of discontent about the measure from hardline conservative Republicans from both chambers who said they wanted the bill to eliminate the entire health care overhaul, not just key legs of it.

A pair of presidential contenders — Sens. Ted Cruz, R-Texas, and Marco Rubio, R-Fla. — along with Sen. Mike Lee, R-Utah, sent a letter this week to House Republicans urging opposition to the bill, saying “This simply isn’t good enough.”

The House bill’s GOP authors said they were constrained by procedural hurdles: legislation receiving the filibuster protections cannot increase the deficit — which repealing the entire health care law would do.

Groups that lined up behind the House measure included the National Right to Life Committee and the National Retail Federation.

In a statement promising Obama’s veto, the White House said the GOP measure “would take away critical benefits and health care coverage from hard-working middle-class families.”

The legislation would eliminate the health law’s requirements that most people who don’t have employer-provided health coverage buy individual policies, and that most companies provide medical insurance. It would also eliminate the statute’s taxes on medical devices and high-priced insurance policies.

It also prevents Planned Parenthood from getting federal money for a year — the GOP reaction to secretly recorded tapes that showed the group’s officials describing how they sometimes provide researchers with tissue from aborted fetuses.