WASHINGTON (AP) — In a triumph for President Barack Obama, sweeping legislation to strengthen the administration's hand in global trade talks advanced toward Senate passage Thursday after a showdown vote that remained in doubt until the final moment.

The 62-38 vote, two more than the 60 needed, came from a solid phalanx of Republicans and more than a dozen Democrats. But the decisive thumbs-up came — literally, and long past the allotted time — from Democratic Sen. Maria Cantwell of Washington after she and a few others seized the moment as leverage to demand a vote next month on legislation to renew the Export-Import Bank.

"It was a nice victory. We're going to continue and finish up the bill this week," Majority leader Mitch McConnell, R-Ky., and Obama's most important Senate ally on the trade bill, said after sealing the agreement that Cantwell, Republican Sen. Lindsey Graham of South Carolina and others had sought.

The Senate action to move toward a final vote was "a big step forward," Obama said at the White House, predicting that a trade deal would "open up access to markets that too often are closed." The president was up late Wednesday night placing telephone calls to lawmakers, and he spoke with Cantwell again shortly before the vote.

Final Senate passage would clear the way for a fierce struggle in the House.

The legislation would allow Obama to make trade deals that Congress could either support or reject but not change. Previous presidents have had similar authority, and administration officials argue that Japan and other Pacific-region countries in a current round of 12-nation trade talks will be unwilling to present bottom-line offers if they know lawmakers can seek more concessions.

But the real political divide is over the value of international trade agreements themselves, and the result has been a blurring of traditional political lines.

Supporters say such agreements benefit the American economy by lowering barriers overseas and expanding markets for U.S. services and goods.

Story continues

But in rebuttal that became particularly pronounced two decades ago when President Bill Clinton sought and won a North American Free Trade Agreement, labor unions and Democratic allies in Congress argue the deals cost jobs at home and send them to nations with lax environmental and safety standards and low wages.

The trade measure is one of three major bills pending in the Senate as lawmakers look toward a weeklong Memorial Day recess set to begin at week's end.

Legislation to renew the Patriot Act is also on the calendar, as is a bill to renew authority for the government to commit federal funds for highway and bridge construction. Both face a June 1 deadline, and McConnell is particularly intent on making sure the anti-terrorism Patriot Act doesn't lapse at a time Republicans hold the majority in Congress.

The House has passed White House-backed legislation that would make a significant change in the government's bulk collection of Americans' phone records. A Senate vote is expected once the trade bill has passed, but it is unclear if there are the 60 votes needed to send it to Obama for his signature.

The House has also cleared a two-month extension of highway funding. It is likely to be accepted by the Senate, and serve as prelude to a second round of work this summer on a longer-term bill.

As for the trade bill, Speaker John Boehner, R-Ohio supports the business-backed legislation, and Republicans hold 245 seats in the House. But dozens of rank-and-file GOP lawmakers are opposed either on ideological grounds or because they say they do not want to enhance Obama's power at their own expense.

Democratic support is weak, given the opposition of organized labor. But Rep. Nancy Pelosi of California, the party's leader, has yet to announce her position and has said repeatedly she hopes to be able to facilitate the bill's passage.

A similar political divide exists in the Senate, although the presence of a dozen or so pro-trade Democrats should give the trade bill the 60-vote majority needed to pass.

In recent days, though, the bill's fate became entwined with the future of the Export-Import Bank, a relatively little-known federal agency that helps companies conduct business overseas. It is due to go out of existence on June 30, and Cantwell, Graham and others had made it clear they wouldn't vote to advance the trade bill unless McConnell agreed to allow a vote next month to keep it in business.

Cantwell said several projects are in line for bank approval by the end of July, and "no one wants to put these important opportunities that hard-working American businesses have secured ... at jeopardy." Her office said there were 47 in all, worth $18.4 billion.

McConnell said this week that while he opposes the bank, its supporters are "entitled to a vote."

Still, it took the presidential phone calls, closed-door Capitol meetings and urgent, private pleadings on the Senate floor in full view of the galleries before Cantwell stepped forward to cast her vote.

Within minutes, Graham followed suit, as did Democratic Sens. Heidi Heitkamp of North Dakota, Claire McCaskill of Missouri and Chris Coons of Delaware.

___

Associated Press writers Erica Werner, Alan Fram and Nancy Benac contributed to this report.