WASHINGTON — Congress gave final approval Wednesday to legislation that would expedite the Keystone XL pipeline, setting up the first substantial veto showdown of President Obama’s administration.

Passage provides the new Congress with a legislative victory after a series of stumbles in the early weeks of Republican control. The House voted 270-152, as Democrats joined most Republicans to approve the bill, following similar bipartisan passage by the Senate.

Republican leaders from both chambers celebrated the hard-fought achievement in a ceremonial room in the Capitol on Wednesday, and dared Obama to defy environmental advocates pushing him to kill the project.

“Instead of listening to the people, the president’s standing with a bunch of left fringe extremists and anarchists,” House Speaker John A. Boehner, R-Ohio, said before Wednesday’s vote. “The president needs to listen to the American people and say, ‘Yes, let’s build the Keystone pipeline.'”

Obama has already vowed to veto the bill. The measure would effectively allow Congress to bypass his authority to approve or reject the project. The administration prefers to allow the ongoing State Department review to be completed before Obama makes a final decision.

Congress does not appear to have the votes to override a presidential veto, even though 29 Democrats in the House and nine in the Senate joined most Republicans in supporting passage.

The $8 billion pipeline would haul oil from the tar sands of Alberta, Canada, through the American heartland to Nebraska, for eventual delivery to the Gulf Coast.

Supporters call it a jobs bill that will unleash new energy resources and 42,000 construction and related jobs.

But a State Department review showed the number of permanent jobs would drop to just 35 once the line is operating.

“There is no reason to continue to stall this project,” said Rep. Jeff Denham, R-Calif., who called it the “safest pipeline ever.”

Opponents worry the new infrastructure will only increase global oil dependence, worsen climate change and pose environmental risks.

As oil prices have plummeted, some analysts have questioned whether the project pencils out.

But Congress has pressed forward, and the legislation became a crucial early test for the new Republican majority, which made passage of the Keystone legislation a top priority.

After initial approval in the House in January, the pipeline bill got bogged down in the Senate after Majority Leader Mitch McConnell promised a free-wheeling debate as part of his commitment to running an open Senate.