"This discussion is going to be examined continually ... as long as we have this many members in the House of Representatives that are saying it's OK to collect all records you want just as long as you make sure you don't let it go anywhere else,"' said Conyers, the top Democrat on the House Judiciary Committee. "That is the beginning of the wrong direction in a democratic society."
The showdown vote marked the first chance for lawmakers to take a stand on the secret surveillance program since former NSA systems analyst Edward Snowden leaked classified documents last month that spelled out the monumental scope of the government's activities.
(Read more: Snowden to stay at Moscow airport: Lawyer)
Backing the NSA program were 134 Republicans and 83 Democrats, including House Speaker John Boehner, R-Ohio, who typically does not vote, and Democratic leader Nancy Pelosi. Rejecting the administration's last-minute appeals to save the surveillance operation were 94 Republicans and 111 Democrats.
"I am particularly pleased that members on both sides of the aisle worked together to preserve critical intelligence tools that have proven successful in preventing terrorist attacks and keeping America safe," Boehner said in a statement after the vote.
It is unlikely to be the final word on the worldwide debate over the U.S. government snooping to defend the nation versus the privacy of Americans.
"Have 12 years gone by and our memories faded so badly that we forgot what happened on Sept. 11?" Rep. Mike Rogers, R-Mich., chairman of the House Intelligence Committee, said in pleading with his colleagues to back the program during House debate.
Amash defended his effort, saying the aim was to end the indiscriminate collection of Americans' phone records.
(Read more: Microsoft Helped NSA Access Encrypted Messages: Report)
His measure, offered as an addition to a $598.3 billion defense spending bill for 2014, would have canceled the statutory authority for the NSA program, ending the agency's ability to collect phone records and metadata under the USA Patriot Act unless it identified an individual under investigation.
The House later voted to pass the overall defense bill, 315-109.
Amash told the House that his effort was to defend the Constitution and "defend the privacy of every American."
The unlikely political coalitions were on full display during a brief but spirited House debate.
"Let us not deal in false narratives. Let's deal in facts that will keep Americans safe," said Rep. Michele Bachmann, R-Minn., an Intelligence Committee member who implored her colleagues to back a program that she argued was vital in combating terrorism.
But Rep. Jim Sensenbrenner, R-Wis., a senior member of the Judiciary Committee who helped write the USA Patriot Act, insisted "the time has come" to stop the collection of phone records that goes far beyond what he envisioned.
Several Republicans acknowledged the difficulty in balancing civil liberties against national security, but they also expressed suspicion about the Obama administration's implementation of the NSA programs—and anger at National Intelligence Director James Clapper.
Clapper has acknowledged he gave misleading statements to Congress on how much the U.S. spies on Americans. He apologized to lawmakers earlier this month after saying in March that the U.S. does not gather data on citizens—something that Snowden revealed as false by releasing documents showing the NSA collects millions of phone records.
"Right now the balancing is being done by people we do not know, people who lied to this body," said Rep. Mick Mulvaney, R-S.C.
With a flurry of letters, statements and tweets, both sides lobbied intensely in the hours prior to the vote in the Republican-controlled House. In a statement, Clapper warned against dismantling a critical intelligence tool.
Since the Sept. 11, 2001, attacks, Congress has authorized—and a Republican and a Democratic president have signed—extensions of the powers to search records and conduct roving wiretaps in pursuit of terrorists.
Two years ago, in a strong bipartisan statement, the Senate voted 72-23 to renew the USA Patriot Act, and the House backed the extension 250-153.
Since the disclosures this year, however, lawmakers have said they were shocked by the scope of the two programs—one to collect records of hundreds of millions of calls and the other allowing the NSA to sweep up Internet usage data from around the world that goes through nine major U.S.-based providers.
Proponents argue that the surveillance operations have been successful in thwarting at least 50 terror plots across 20 countries, including 10 to 12 directed at the United States.
The overall defense spending bill would provide the Pentagon with $512.5 billion for weapons, personnel, aircraft and ships, plus $85.8 billion for the war in Afghanistan for the next budget year.
The total, which is $5.1 billion below current spending, has drawn a veto threat from the White House, which argues that it would force the administration to cut education, health research and other domestic programs in order to boost spending for the Pentagon.
The bill must be reconciled with whatever measure the Democratic-controlled Senate produces.
—By The Associated Press.