The law on intelligence-gathering comes nearly four months after three days of attacks in Paris in January, in which 17 people were killed.
The socialist government said the law is needed to take account of changes in communications technology.
The draft, which has yet to be reviewed by the senate before becoming law, would allow French intelligence officers to install recording devices in private homes and cars, intercept phone conversations outside of judicial oversight and collect connection data of suspects.
It goes further in the case of a suspected terrorist threat by enabling French agents to plug black boxes directly in to networks and servers of telecom and internet operators to monitor online traffic and detect suspicious behaviour with the help of algorithms.
Prime minister Manuel Valls, who has opted for accelerated “emergency” legislative procedure to pass the bill, has defended the measures as “important progress for our intelligence services and our democracy”.
It is crucial, the government has emphasised, to give a legal framework to intelligence agents who are already pursuing some of these practices illegally, following the examples of the US and the UK.
Mr Valls said: “This bill gives concrete guarantees to our fellow citizens to an [unprecedented] extent in matter of intelligence.”
Critics say it is a dangerous extension of mass surveillance. They argue that it gives too much power to the state and threatens the independence of the digital economy.
The government says it wants to bring modern surveillance techniques within the law rather than outside any system of control.
There will be a new watchdog to keep an eye on the intelligence services, which will have broader powers to look at classified material and handle complaints from the public.
But none of this has satisfied the critics, who range from civil liberties groups to major internet providers.
Their main worry is the way French intelligence agencies will be able to collect amounts of metadata from the internet – the detail of communications such as times and places rather than content.
The law passed through parliament by 438 votes to 86. Apart from some dissident voices, both the governing Socialist Party and opposition centre-right were in favour.