BERLIN — A narrow majority of voters in Switzerland approved proposals on Sunday that would reintroduce restrictions on the number of foreigners who are allowed to live and work in the country, a move that could have far-reaching implications for Switzerland’s relations with the European Union.

The referendum on the changes to the country’s liberal immigration law was a rebuke to the Swiss government, the banking industry and business leaders who had lobbied against the restrictions, warning that such a move could endanger Switzerland’s prosperity.

The admonitions failed to drown out the warnings of the rightist Swiss People’s Party, which introduced the referendum that it said was necessary if Switzerland was to retain its identity in the face of immigration.

Switzerland, which is not part of the European Union, has one of the highest proportions of foreigners in Europe, accounting for about 27 percent of the country’s population of about eight million. Many job seekers have arrived from countries hit hard by the European economic crisis.