US President Donald Trump has signed into law a bill that extends the controversial surveillance program by the National Security Agency (NSA) for another six years.

Trump signed the renewal of the Foreign Intelligence Surveillance Act (FISA) into law on Friday, but said it was different from the existing version, presstv.com reported.

Announcing the signing of the bill, he tweeted, “Just signed 702 Bill to reauthorize foreign intelligence collection.”

However, he added, "This is NOT the same FISA law that was so wrongly abused during the election. I will always do the right thing for our country and put the safety of the American people first!"

The Senate approved the bill Thursday after it cleared the procedural 60-vote threshold needed to restrict debate earlier on Tuesday. The measure easily passed the House of Representatives last week.

The US Senate has advanced a bill to renew the National Security Agency's warrantless internet surveillance program.

Shortly before the House vote, and after talking with House Speaker Paul Ryan, Trump did an apparent about-face.

“This vote is about foreign surveillance of foreign bad guys on foreign land,” he tweeted. ‘We need it! Get smart!’

The bill, which was set to expire Friday, has now been approved by Congress three times under three different presidents.

The NSA has been collecting phone calls, texts and emails of the American people as well as those of other nationals.

Privacy advocates say the program enables the NSA and other intelligence agencies to gather data belonging to Americans in a way that affronts the US Constitution.

“Without additional meaningful constraints, Congress is allowing the government to use information collected without a warrant against Americans in domestic court proceedings,” Republican Senator Rand Paul and Democratic Senator Ron Wyden, vocal opponents of the legislation, wrote in a letter to Senate colleagues last week.