The bill signed into law by President Barack Obama ends the government's massive collection of telephone call data intended to prevent terrorist attacks, part of a national security program that had expired earlier this week.
The controversial surveillance program was part of a bill given final passage earlier Tuesday by the U.S. Senate, after being approved by the House several days earlier. The measure also reauthorizes two other national security programs that had also lapsed.
"Glad the Senate finally passed the USA Freedom Act. It protects civil liberties and our national security," President Barack Obama said on Twitter shortly before he signed it Tuesday afternoon.
In a separate statement earlier, Obama chided lawmakers for the "needless delay and inexcusable lapse in important national security authorities," in the days leading up to the bill's eventual passage.
The bill halts the National Security Agency's ability to scoop up and store metadata -- telephone numbers, dates and times of calls -- from millions of Americans who have no connection to terrorism.
It shifts responsibility for storing the data to telephone companies, such as Verizon and AT&T, allowing authorities to access the information only with a warrant from a secret counterterror court that identifies a specific person or group of people suspected of terror ties.
Many major Internet firms declared victory with the congressional approval.
"The USA Freedom Act realizes hard-fought and much-needed wins for Internet users everywhere, including prohibiting the bulk collection of user data," Yahoo said in a statement.
Microsoft Corp. General Counsel Brad Smith praised Congress. "Today's vote by the Senate on the USA Freedom Act will help to restore the balance between protecting public safety and preserving civil liberties," he said in a statement.
Reform possible, not enough
The American Civil Liberties Union said the measure was a milestone, but it did not go far enough. "The passage of the bill is an indication that comprehensive reform is possible, but it is not comprehensive reform in itself," ACLU deputy legal director Jameel Jaffer said in a statement.
Human Rights Watch issued a statement saying passage of the USA Freedom Act "marks what could be a turn of the tide against mass surveillance" in the United States, while failing to address many other modern surveillance capabilities, including intercepting mobile calls.
"It's a historic moment," Senator Patrick Leahy, the senior Democratic sponsor of the bill, said after the 67-32 vote, describing the bill as "the first major overhaul of government surveillance laws in decades."
The government began keeping records of telephone numbers, but not the content of those calls, just after the September 11, 2001, terrorist attacks on New York and Washington.
The vote followed days of sharp debate on the floor, with many Republicans split over their support for strong counterterror measures and the need for personal privacy protections in the wake of former NSA contractor Edward Snowden's bombshell revelations about the bulk data dragnet in 2013.
Some specifics about the bill:
Q: What happens with the phone records collection?
A: It will resume for six months, provided that the Foreign Intelligence Surveillance Court orders phone companies to turn over the records and that no court stops it under various pending lawsuits. During that period, the NSA will seek to work with providers to come up with a way to quickly query their records against known terrorist phone numbers, pursuant to a court order.
It will be able to collect data for all the numbers in contact with the suspect number, and all the numbers in contact with those numbers, meaning the NSA will still be rooting around in Americans' phone records, but it won't be collecting all of them.
Q: What about the American calling records the NSA has been collecting for years?
A: Obama administration officials have not said what they will do with those and whether they will continue to search them.
Q: What about the other surveillance provisions that expired?
A: The roving wiretap provision, which allows the FBI to eavesdrop on espionage and terror suspects who discard cellphones frequently, will go back into effect, as will the lone-wolf provision, which has never been used. The FBI will still be able to use Section 215 of the Patriot Act to collect a variety of business records in national security investigations. But the new law requires the government to limit the scope of its collection, prohibiting it from grabbing, for example, all information relating to a particular service provider or area code.
Q: What else will change under the USA Freedom Act?
A: The new law gives private companies more leeway to publicly report information about the number of national security surveillance demands they receive. And it requires declassification of FISA Court opinions containing significant legal decisions, or a summary if declassification is not possible. That is designed to prevent secret interpretations such as the one that allowed bulk collection of U.S. phone records.
Q: Does this legislation address the concerns raised by Snowden's disclosures?
A: It addresses the most controversial program he revealed, the domestic phone records collection. But it does nothing to affect another major Snowden revelation: the NSA's collection of foreign Internet content from U.S. tech companies, a program that sweeps up lots of American communications. And it doesn't address the bulk of Snowden disclosures about foreign intelligence gathering and the NSA's attempts to exploit technology, such as encryption, for the benefit of U.S. intelligence.
Q: Who are the political winners and losers coming out of this legislative fight?
A: Winners include Obama, who proposed this idea more than a year ago to assuage public concerns about surveillance, and congressional Democrats, who backed it. Also coming out ahead are libertarian Republicans, including Senator Rand Paul of Kentucky, a 2016 presidential candidate who used Senate rules to box in his own party's leaders.
The biggest loser by any measure is Senate Majority Leader Mitch McConnell, also of Kentucky, who opposed the USA Freedom Act and thought he could force the House to accept a last-minute extension of current law. But because of Paul and others, McConnell couldn't make that happen. He then saw his proposed changes to the USA Freedom Act defeated.
McConnell called the reform bill "a step backward."
"This is going to diminish our ability to respond to the myriad threats we have today," he said in a provocative floor speech in which he accused the Obama administration of withdrawing from leadership in the battle against extremism.
Some Republicans on Tuesday seemed eager to put the surveillance debate behind them, and to give McConnell a break. "It was a busy month," said Senator Lamar Alexander, pointing to a major trade bill and other legislation the Senate handled. "We just ran out of time."
But Senator Mike Lee of Utah was less forgiving. Congress knew for years that the Patriot Act would expire, he said in a speech Tuesday, and the Senate should have resolved the matter "long before now."
VOA's Mia Bush contributed to this report. Material for this report came from AP, AFP and Reuters.
Related video: U.S. Senate ends government collection of phone records