"The main aim of this law is to better receive foreigners who come to our country legally'" Interior Minister Bernard Cazeneuve told the National Assembly during the final debate of the bill, which had a rough ride in the right-wing-controlled Senate.
Its most important measures are:
Residency papers lasting two to four years after a foreign resident's first year, to avoid annual visits to préfectures to renew them;
A "talent passport", lasting four years, to group together a number of existing categories for people with special skills, such as artists, scientists and athletes;
A visit by a specialised magistrate after 48 hours for migrants held in a retention centre prior to deportation, instead of after five days - a concession to NGOs who say that half of deportations take place without a magistrate verifying that the detention is legal.
Former president Nicolas Sarkozy's Republicans tried to amend the law to introduce three-yearly quotas for immigrants and restrict issuing residency papers to foreigners who are ill.
They voted against the bill at its final reading, claiming that it would increase immigration and promising to repeal it if they win the 2017 presidential election.
"Is it useful to increase the attractiveness of our country at this moment?" Republicans MP Guy Geoffroy asked.
The hard-left Left Front abstained, accepting that there had been some "important advances" but claiming that it did not break with the "logic of suspicion of foreigners living in France" and calling for a ban on placing minors in retention centres.
About 200,000 foreigners are authorized to stay in France each year, at 0.3 per cent of the population one of the lowers figures in the OECD group of wealthier countries.