The vote was 217-205 on an issue that created unusual political coalitions in Washington, with libertarian-leaning conservatives and liberal Democrats pressing for the change against the Obama administration, the Republican establishment and Congress' national security experts.
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.
It is unlikely to be the final word on government intrusion to defend the nation and Americans' civil liberties.
"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 Intelligence committee, said in pleading with his colleagues to back the program during House debate.
Republican Rep. Justin Amash of Michigan, chief sponsor of the repeal effort, said his aim was to end the indiscriminate collection of Americans' phone records.
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.
Amash told the House that his effort was to defend the Constitution and "defend the privacy of every American."
The unusual political coalitions were on full display during a spirited but brief 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., a member of the Intelligence committee who implored her colleagues to back a program that she argued was vital in combatting terrorism.
But Rep. Jim Sensenbrenner, R-Wis., a senior member of the Judiciary Committee who helped write the Patriot Act, insisted "the time has come" to stop the collection of phone records.
Several Republicans acknowledged the difficulty in balancing civil liberties against national security, but expressed suspicion about the Obama administration's implementation of the NSA programs -- and anger at Director of National Intelligence James Clapper.
"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.
He was referring to Clapper who admitted he gave misleading statements to Congress on how much the U.S. spies on Americans. Clapper 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.
With a flurry of letters, statements and tweets, both sides lobbied furiously in the hours prior to the vote in the Republican-controlled House. In a last-minute 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 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.
Although Republican leaders agreed to a vote on the Amash amendment, one of 100 to the defense spending bill, time for debate was limited to 15 minutes out of the two days the House dedicated to the overall legislation.
The White House and the director of the NSA, Army Gen. Keith Alexander, made last-minute appeals to lawmakers, urging them to oppose the amendment. Rogers and Rep. C.A. Dutch Ruppersberger, D-Md., leaders of the House Intelligence committee, implored their colleagues to back the NSA program.
Eight former attorneys general, CIA directors and national security experts wrote in a letter to lawmakers that the two programs are fully authorized by law and "conducted in a manner that appropriately respects the privacy and civil liberties interests of Americans."
White House press secretary Jay Carney issued an unusual, nighttime statement on the eve of Wednesday's vote, arguing that the change would "hastily dismantle one of our intelligence community's counterterrorism tools."
Proponents of the NSA programs 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. Among them was a 2009 plot to strike at the New York Stock Exchange.
Rogers joined six GOP committee chairmen in a letter urging lawmakers to reject the Amash amendment.
"While many members have legitimate questions about the NSA metadata program, including whether there are sufficient protections for Americans' civil liberties," the chairman wrote, "eliminating this program altogether without careful deliberation would not reflect our duty, under Article I of the Constitution, to provide for the common defense."
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.
In a leap of faith, the bill assumes that Congress and the administration will resolve the automatic, across-the-board spending cuts that have led the Pentagon to furlough workers and cut back on training. The bill projects spending in the next fiscal year at $28.1 billion above the so-called sequester level.
By voice vote, the House backed an amendment that would require the president to seek congressional approval before sending U.S. military forces into the 2-year-old civil war in Syria.
Rep. Trey Radel, R-Fla., sponsor of the measure, said Obama has a "cloudy foreign policy" and noted the nation's war weariness after more than 10 years of conflict in Iraq and Afghanistan.
The administration is moving ahead with sending weapons to vetted rebels, but Obama and members of Congress have rejected the notion of U.S. ground forces.
The House also adopted, by voice vote, an amendment barring funds for military or paramilitary operations in Egypt. Several lawmakers, including Rep. Kay Granger, R-Texas, who heads the panel overseeing foreign aid, expressed concerns about the measure jeopardizing the United States' longstanding relationship with the Egyptian military.
The sponsor of the measure, Rep. Thomas Massie, R-Ky., insisted that his amendment would not affect that relationship.
The overall bill must be reconciled with whatever measure the Democratic-controlled Senate produces.
Take ABC13 with you!
Download our free apps for iPhone, iPad, and Android devices