Two days after Congress let the phone-records collection and several other anti-terror programs expire, the Senate's 67-32 vote sent the legislation to President Barack Obama, who signed it Tuesday night.
"This legislation will strengthen civil liberty safeguards and provide greater public confidence in these programs," Obama said in a statement. Officials said it could take at least several days to restart the collection.
The legislation will revive most of the programs the Senate had allowed to lapse in a dizzying collision of presidential politics and national security policy. But the authorization will undergo major changes, the legacy of agency contractor Edward Snowden's explosive revelations two years ago about domestic spying by the government.
In an unusual shifting of alliances, the legislation passed with the support of Obama and House Speaker John Boehner, R-Ohio, but over the strong opposition of Senate Majority Leader Mitch McConnell. McConnell failed to persuade the Senate to extend the current law unchanged, and came up short in a last-ditch effort Tuesday to amend the House version, as nearly a dozen of his own Republicans abandoned him in a series of votes.
"This is a step in the wrong direction," a frustrated McConnell said on the Senate floor ahead of the Senate's final vote to approve the House version, dubbed the USA Freedom Act. He said the legislation "does not enhance the privacy protections of American citizens. And it surely undermines American security by taking one more tool form our warfighters at exactly the wrong time."
The legislation remakes the most controversial aspect of the USA Patriot Act — the once-secret bulk collection program that allows the National Security Agency to sweep up Americans' phone records and comb through them for ties to international terrorists. Over six months the NSA would lose the power to collect and store those records, but the government still could gain court orders to obtain data connected to specific numbers from the phone companies, which typically store them for 18 months.
It would also continue other post-9-11 surveillance provisions that lapsed Sunday night, and which are considered more effective than the phone-data collection program. These include the FBI's authority to gather business records in terrorism and espionage investigations and to more easily eavesdrop on suspects who are discarding cellphones to avoid surveillance.
In order to restart collection of phone records, the Justice Department will need to obtain a new order from the Foreign Intelligence Surveillance Court.
"This legislation is critical to keeping Americans safe from terrorism and protecting their civil liberties," Boehner said. "I applaud the Senate for renewing our nation's foreign intelligence capabilities, and I'm pleased this measure will now head to the president's desk for his signature."
The outcome capped a dramatic series of events on Capitol Hill that saw a presidential candidate, GOP Sen. Rand Paul of Kentucky, defy fellow Republicans and singlehandedly force the existing law to lapse Sunday at midnight, leading to dire warnings of threats to America.
The suspense continued Tuesday as McConnell tried to get the Senate to go along with three amendments he said would make the House bill more palatable. But House leaders warned that if presented with the changes the House might not be able to approve them. The Senate denied McConnell's attempts, an embarrassment for the leader six months after Republicans retook Senate control.
The changes sought by McConnell included lengthening the phase-out period of the bulk records program from six months to a year; requiring the director of national intelligence to certify that the NSA can effectively search records held by the phone companies; and making phone companies notify the government if they change their policy on how long they hold the records. Most controversially, McConnell would have weakened the power of a new panel of outside experts created to advise the Foreign Intelligence Surveillance Court.
The final vote divided Senate Republicans, with 23 voting "yes" and 30 voting "no," and senators seeking re-election in 2016 split on the issue.
Among GOP presidential candidates, Sen. Ted Cruz of Texas was the only "yes" vote, while Sen. Marco Rubio of Florida joined Paul in opposing the bill. Sen. Lindsey Graham of South Carolina, who announced for president Monday, was absent. Independent Sen. Bernie Sanders of Vermont, who is running on the Democratic side, also voted no.
Civil liberties groups have been mixed on the legislation, but the American Civil Liberties Union applauded the vote, with Deputy Legal Director Jameel Jaffer calling it "a milestone."
Snowden, now in Russia and reviled by lawmakers of both parties, addressed the vote via video link during an event hosted by Amnesty International. He said the legislation was historic because Americans are questioning long-held assumptions that intelligence officials always act in their best interest.
"For the first time in recent history, we found that despite the claims of government, the public made the final decision and that is a radical change we should seize on, we should value and we should push forward," he said.
Associated Press writers Anne Flaherty, Ken Dilanian and Jim Kuhnhenn contributed to this report.