The US House of Representatives has approved a law allowing US spy agencies to continue intercepting Americans' private communications.
President Donald Trump prompted confusion before the vote with a tweet claiming the programme had been used to "abuse" his campaign.
The legislation passed 256-164, despite opposition from both sides. The 'no' votes included 45 Republicans.
Critics say the bill actually expands government powers to spy on Americans.
The act's passage follows a year-long debate about the proper scope of US electronic wiretapping after the 2013 leaks of surveillance secrets by former National Security Agency (NSA) contractor Edward Snowden.
On Thursday morning, the US president tweeted that the programme had been used by the Obama administration to "so badly surveil and abuse the Trump campaign".
Senior Democrats urged cancellation of the vote following Mr Trump's post.Image copyright EPA Image caption Democrats like Nancy Pelosi called for the vote to be cancelled
After speaking on the phone with House of Representatives Speaker Paul Ryan, the president posted a follow-up tweet barely two hours later.
He said that "today's vote is about foreign surveillance of foreign bad guys on foreign land. We need i...