Swiss MPs have backed a bill giving jobseekers already in the country priority over applicants from EU member states in times of high unemployment.
It follows a referendum in 2014 in which voters narrowly backed introducing quotas on workers from EU countries.
The measure makes no mention of quotas but sets out guidelines for employers.
The new law was a compromise which sought not to antagonise the EU, says the BBC's Imogen Foulkes in Geneva.
Although Switzerland is not a member of the EU, it enjoys access to the free trade area.
Brussels had said the imposition of quotas would violate the bilateral agreements over free movement of people which are a condition of access to the single market.
But it offered a cautious welcome to the bill on Friday, with European Commission spokesman Margaritis Schinas telling reporters: "At first glance, the law really seems to go in the right direction."
The compromise bill angered the conservative Swiss People's Party (SVP), which wants specific caps on immigration. Its deputies held up posters with slogans complaining that "mass immigration continues!" following the vote.
Has this vote resolved the immigration issue?
Not necessarily, writes Imogen Foulkes. The referendum in 2014 called for quotas. This bill is a very long way from that - all it does is ask employers to consider jobseekers already in Switzerland, and even then only if unemployment in certain sectors or regions is much higher than the national average.
The SVP argues this is a betrayal of voters' wishes, but at the same time the party is not threatening a referendum to block the new law. That's because the original majority in favour of quotas was tiny, and in the years since it took place immigration to Switzerland has stabilised, even fallen somewhat.
What's more the Swiss are determined not to lose access to the single market, and Brussels has made it clear that imposing quotas could cause that. Even the suggestion of quotas had consequences - Switzerland was thrown out of various Europe wide research and exchange programmes as soon as the 2014 vote result came in.
So a new referendum starting the whole worrying debate all over again is unlikely to find favour.
BUT, if Switzerland's booming economy falters, if unemployment and immigration rise, it is likely the Swiss People's Party will seize the opportunity, and go back to the voters again, this time with a demand not for quotas, but to get out of free movement of people altogether.
Why is this issue important for Europe as well as Switzerland?
Right across Europe the issue of free movement of people is under scrutiny, our correspondent says.
Immigration was a key factor in Britain's vote to leave the EU. Everyone wants to know just how much wiggle room there is in Brussels' oft-repeated dictum that free trade and free movement go together, and that countries (EU member or not) cannot have one without the other.
The Swiss proposal is very modest and would be unlikely to satisfy those voters in the UK who want complete control of the borders. On the other hand millions of EU and Swiss citizens now live and work outside their own home countries. Hundreds of thousands of Germans, French, Swiss, Austrians and Italians commute daily across borders to go to work.
They are used to the freedom to look for jobs across the continent, and any move that might curtail that freedom, even the Swiss compromise, may meet opposition.