ZURICH (Reuters) - Switzerland approved a law on Friday aimed at curbing immigration by giving local people first crack at open jobs, skirting voters’ demand for outright quotas that it feared could disrupt close ties with the European Union.

After parliament passed the new immigration law , the focus will now shift to how the EU responds.

Brussels so far has shown scant flexibility on the free movement of people - the principle underpinning Swiss access to the single market -- so as not to encourage Britain as it negotiates its EU divorce.

The lack of upper limits on immigration to a country of 8.3 million, whose population is already a quarter foreign, prompted the right-wing Swiss People’s Party to assert that politicians had defied the people’s will in a 2014 referendum.

The SVP, the largest party in parliament, has accused other parties of kowtowing to Brussels and shirking their duty to stand up for Swiss sovereignty. Its members held up signs protesting the final vote reading “constitutional breach” and “mass immigration continues”.

But a clear majority in parliament did not want to risk a row with the EU, Switzerland’s main trading partner, which could retaliate by abrogating other bilateral accords easing trade in sectors that account for 7 percent of Swiss economic output.

Nearly 1.4 million EU citizens live in Switzerland and another 365,000 commute in from neighboring countries.

The Swiss think that gives them leverage with Germany, France and Italy, whose leaders may not want to have to explain to voters - especially those in border regions with strong populist party support - why they can no longer work in high-wage Swiss jobs.

Passage of the law clears the way for Switzerland to extend free movement of people to the latest EU member Croatia. That in turn will restore Swiss access to the EU’s Horizon 2020 program, which funds research projects.

In any event, Swiss voters look set to decide for a second time whether to impose curbs on immigration or reaffirm close economic ties with the bloc.