WASHINGTON — The House dramatically rescued President Obama’s trade agenda from near oblivion Thursday, and supporters urged the Senate to finish the job and give him a signature achievement in his final years in office.

The turnabout gave a much-needed lift to a president recently rebuffed by his own party after years of fighting Republicans.

In one of the strangest twists of his presidency, most fellow Democrats oppose Obama on trade, forcing him to rely heavily on Republicans to ease the path for possibly far-reaching trade accords in Asia and elsewhere.

The president needs comparatively small numbers of Democrats in both chambers. His supporters were encouraged by Thursday’s events.

The same 28 House Democrats who previously backed Obama’s bid for “fast track” negotiating authority held firm, despite withering criticism from unions and liberal groups. Under that authority, a president can negotiate liberalized trade deals that Congress can only approve or reject, not change.

Opponents of Obama’s path on trade now are focusing on 14 Democratic senators who backed fast track earlier, and will be needed again when the Senate revisits the issue this month. There were no open signs of erosion Thursday, although Democrats are demanding inclusion of a job retraining program, with details of it still incomplete.

House Speaker John Boehner, R-Ohio, said Republicans are committed to ensuring that the negotiating authority and retraining program pass for Obama’s signature into law.

Corporate groups and other free-trade supporters hailed the House vote Thursday approving the negotiating authority. It passed 218-208, proving the importance of the 28 Democratic supporters.

Maine Reps. Chellie Pingree, a Democrat, and Bruce Poliquin, a Republican, voted against the measure.

“This vote is a huge step with the administration and for a nation which rejects isolationism and protectionism,” said Gary Shapiro, president of the Consumer Electronics Association.

Liberal groups fumed.

“A handful of turncoat Democrats” who backed the legislation “should know that we will not lift a finger or raise a penny to protect you when you’re attacked in 2016,” said Jim Dean of Democracy for America. He said the group will try to oust those lawmakers in future Democratic primaries.

Lawmakers agree that major trade deals, including the long-negotiated Trans-Pacific Partnership, cannot be completed unless negotiating partners know that Congress won’t tinker with the final agreement.