The US House of Representatives has rejected the Amash amendment, voting to continue collecting data on phone calls, in the first legislative move on the programme.
In a 205-217 vote, lawmakers rejected an effort to restrict the National Security Agency’s (NSA) ability to collect electronic information.
The NSA’s chief had lobbied strongly against the proposed measure.
The vote saw an unusual coalition of conservatives and liberal Democrats join forces against the programme.
The details of the NSA dragnet were made public by Edward Snowden, a former contractor for America’s electronic spying agency. He is now a fugitive, seeking asylum in Moscow.
The rejected amendment would have blocked funding for the NSA programme which gathers details of every call made by or to a US phone, unless the records were part of a specific investigation.
The amendment was introduced by Michigan Republican Justin Amash, who warned during Wednesday’s debate that the proposal’s critics would “use the same tactic every government throughout history has used to justify its violation of rights: fear”.
“They’ll tell you that the government must violate the rights of the American people to protect us against those who hate our freedom.”
Despite the White House’s lobbying against the amendment, a majority of House Democrats – 111 – voted for it. Eighty-three Democrats voted against.
Among Republicans, 94 voted for the Amash amendment and 134 against.
Before Wednesday’s vote there were fierce exchanges on the House floor during what was the first sustained legislative debate on the NSA’s reach since Edward Snowden’s revelations.
“We’ve really gone overboard on the security side,” said Democratic Representative Peter Welch of the surveillance, which is part of a classified $30 billion intelligence budget.
But others said the practice was essential in America’s efforts against terrorism.
“Have 12 years gone by and our memories faded so badly that we forgot what happened on September 11?” said Mike Rogers, the Republican chairman of the House intelligence committee.
Minnesota Representative Michele Bachmann, not usually noted for her support of President Barack Obama, also backed the administration’s stance.
“Let us not deal in false narratives,” she said.
“Let’s deal in facts that will keep Americans safe.”
But Republican Jim Sensenbrenner, one of the original authors of the Bush-era Patriot Act, said “the time has come” to stop harvesting phone records.
On the eve of the vote, in a rare statement against a legislative amendment, the White House called the Amash proposal a “blunt approach” that would hamper US anti-terrorism efforts.
NSA director General Keith Alexander held separate, closed-door sessions with Republicans and Democrats on Tuesday to lobby them against the bill.
Another NSA surveillance programme, PRISM, allows the agency to sweep up global internet usage data through nine major US-based providers.
The programmes’ supporters say such surveillance has helped thwart at least 50 terror plots in 20 countries, including up to a dozen directed at the US.
Divided opinion in the US about the snooping was highlighted by a CBS News poll on Wednesday.
The survey found that 67% of Americans opposed the government’s collection of phone records, but 52% said it was necessary to counter terrorism.