The Senate handed President Obama a huge victory Wednesday afternoon, giving him final approval of legislation that enhances his power to negotiate trade deals.

The bill needed just 51 votes, but passed 60-38, making it look almost easy.

But earlier this month, the legislation granting Trade Promotion Authority seemed likely to die because of fierce opposition from many Democrats and some Republicans. Various legislative maneuvers were employed to set back the measure.

In an unusual alliance, Obama worked with Republican leaders in the House and Senate to keep pushing forward. In the end, the House approved it, and now the Senate has signed off.

The legislation now goes to Obama for his signature.

With TPA, the president has the ability to complete trade deals and put them on a so-called "fast track" through Congress.

That means lawmakers can vote only yes or no on a trade agreement, using a simple majority vote with no amendments.

Presidents have had this power for decades, but the authority had expired. Obama wanted it renewed so that he can complete the Trans-Pacific Partnership, a trade deal involving the U.S. and 11 other Pacific Rim nations.

Many Democrats fear that a Pacific Rim trade deal will cost jobs for U.S. factory workers. They tried to stop TPA and hope to ultimately derail TPP. Some Republicans objected to enhancing Obama's authority to deal with foreign countries.

But the White House was firm in its resolve that this president should have the authority past presidents have had to complete trade deals. Obama says completing TPP will expand opportunities for U.S. exports to Asia.

Updated at 5:50 p.m. ET

In a voice vote Wednesday evening, the Senate also approved Trade Adjustment Assistance. This bill, strongly backed by the White House and Democrats, provides assistance to workers who lose jobs because of free trade deals.

The House still needs to approve TAA, and it is expected to do so.

Copyright 2016 NPR. To see more, visit