The Senate handed President Obama a big victory Friday night, passing legislation to strengthen the administration's hand in global trade talks.

The bipartisan vote clears the way for a highly unpredictable summer showdown in the House.

Senators approved the measure on a 62-37 vote. It lets Obama complete trade deals that Congress could approve or reject, but not change. A total of 48 Republicans supported the bill, but only 14 the Senate's 44 Democrats sided with their party leader on legislation near the top of his second-term to-do list.

The trade bill passed as the Republican-led Senate early Saturday refused to pass a House-passed bill to end the National Security Agency’s bulk collection of domestic phone records and to extend the USA Patriot Act on a short-term basis.

The Senate also approved a two-month stop-gap highway funding bill early Saturday before starting a week-long Memorial Day recess.

Senate passage of the trade bill capped two weeks of tense votes and near-death experiences for legislation the administration hopes will help complete an agreement with Japan and 10 other countries in the Pacific region.

Senate Majority Leader Mitch McConnell, R-Ky., and Obama's indispensable ally in passing the bill, said it would create "new opportunities for bigger paychecks, better jobs, and a stronger economy.

"The tools it contains will allow us to knock down unfair foreign trade barriers that discriminate against American workers and products stamped "Made in the USA," he said.

The House is expected to debate the issue as early as next month.

There, Speaker John Boehner, R-Ohio, supports the bill. But dozens of majority Republicans currently oppose it, either out of ideological reasons or because they are loath to enhance Obama's authority, especially at their own expense.

And Obama's fellow Democrats show little inclination to support legislation that much of organized labor opposes.

In the run-up to a final Senate vote, Democratic supporters of the legislation were at pains to lay to rest concerns that the legislation, like previous trade bills, could be blamed for a steady loss of jobs.

"The Senate now has the opportunity to throw the 1990s NAFTA playbook into the dust bin of history," said Sen. Ron Wyden, D-Ore. He referred to the North American Free Trade Agreement, passed two decades ago, and a symbol to this day, fairly or not, of the loss of unemployment to a country with lax worker safety laws and low wages.

Wyden and others said this law had far stronger protections built into it.

One final attempt to add another one failed narrowly, 51-48 a few hours before the bill cleared.

It came on a proposal, by Sens. Rob Portman, R-Ohio, who supported the trade bill, and Debbie Stabenow, D-Mich., who opposed it. They sought to made allegations of currency manipulation subject to the same "dispute settlement procedures" as other obligations under any trade deal.

Treasury Secretary Jacob Lew warned earlier that its approval could cause Obama to veto the legislation. The president has said it could cause the demise of the current round of talks with 11 other Pacific-area nations, and also could pose a threat to the monetary policy that is designed to help the U.S. economy run better.

Portman, who was U.S. trade representative under former President George W. Bush, scoffed at threats of a veto. "I don't think so," he said in remarks on the Senate floor. "I think he (Obama) understands the importance" of his ability to conclude trade deals without congressional changes.

An alternative proposal backed by the White House merely stressed the importance of U.S. negotiators seeking ways to end the practice of currency manipulation, which can lower the price of foreign-made goods and place American-made products at a competitive disadvantage. It cleared on a vote of 70-29.

To mollify Democrats, the bill also included $1.8 billion in retraining funds for American workers who lose their jobs as a result of exports. Sen. Jeff Flake, R-Ariz., said the program duplicated other federal efforts, but his attempt to strip out the funds was defeated, 53-35.

The political alignment on the Patriot Act legislation was different, with the administration and McConnell on different sides.

White House spokesman Josh Earnest prodded the Senate to accept a House-passed bill renewing anti-terrorism programs due to expire June 1. He said that to do otherwise would put at risk "the ability of our national security professionals to keep us safe."

But the House bill included a provision to eliminate the National Security Agency's ability to collect mass telephone records of Americans. Instead, the material would remain with phone companies, with government searches of the information allowed by court order on a case-by-case basis.

"The untried — and as of yet, nonexistent — bulk-collection system envisioned under that bill would be slower and more cumbersome than the one that currently helps keep us safe," McConnell said in remarks on the Senate floor. At worst, he added, "it might not work at all."

The highway bill was the least controversial of the three on the Senate's pre-vacation agenda, but only because lawmakers agreed in advance on a two-month extension of the current law. The House and Senate will need to return to the issue this summer.

Lawmakers whose time generally is scheduled far in advance adjusted as best they could as the Senate struggled with work put off until the last minute.

"It's not the weather, it's the Senate that's the problem," said Sen. Lamar Alexander, R-Tenn., hoping to make it home by Saturday night for a turn as pianist with the Memphis Symphony Orchestra.

The Associated Press contributed to this report.