France and Germany have voiced concern about Switzerland's vote to bring back strict quotas for immigration from European Union countries.
Final results showed 50.3% voted in favour. The vote invalidates the Swiss-EU agreement on freedom of movement.
German Finance Minister Wolfgang Schaeuble said the vote would cause "a host of difficulties for Switzerland".
France's Foreign Minister Laurent Fabius said "it will hurt Switzerland to be inward-looking".
The initiative to hold the referendum was spearheaded by the right-wing Swiss People's Party (SVP), amid increasing debate across Europe about migration and the impact of free movement of people.
Fiercely independent Switzerland is not a member of the EU, but has adopted large sections of EU policy.
The European Commission said it regretted the outcome of the vote and would examine its implications.
Freedom of movement is a key pillar of the EU single market - a market which accounts for more than half of Swiss exports.
The BBC's Imogen Foulkes in Geneva says the vote has shown up traditional divisions, with French-speaking areas in the west against the quotas, German-speaking regions divided, and the Italian-speaking canton of Ticino firmly in favour.
In addition, cities with higher than average numbers of foreigners - Basel, Geneva and Zurich - voted against the quota proposal, while rural areas mostly voted for it.
Switzerland's economy is booming at the moment, and unemployment is low, but many Swiss worry about immigration.
Last year 80,000 new immigrants arrived in Switzerland, and foreigners now make up 23% of the population. It is the continent's second highest foreign population after Luxembourg.
In a statement, the European Commission said the Swiss vote "goes against the principle of free movement of persons between the EU and Switzerland.
"The EU will examine the implications of this initiative on EU-Swiss relations as a whole."
EU Justice Commissioner Viviane Reding told the Financial Times that "the single market is not a Swiss cheese - you cannot have a single market with holes in it".
Mr Fabius told French radio it was bad news "both for Europe and the Swiss". Europe "was going to review its relations" with Switzerland, he added.
The German foreign minister said the vote had to be taken seriously: "This proves a little bit that in this globalised world people feel more discomfort towards unlimited free movement of persons."
European Parliament President Martin Schulz - a German Socialist - expressed disappointment over the vote. He said the EU would "perhaps [have] to renegotiate the agreement" with Switzerland. But he warned that unpicking freedom of movement from other single market freedoms, for example services, would be difficult.
"It is up to the Switzerland government to decide if they want to suspend the agreements with us or not."
Switzerland's bilateral agreements with the EU took years of negotiation to achieve. Our Berne correspondent says that abandoning free movement could limit Switzerland's access to the single market.
A Yes vote of more than 50% was needed for the referendum to pass.
Since 2007, most of the EU's 500 million residents have been on an equal footing with locals in the Swiss job market - the result of a policy voted into law in a 2000 referendum. But a movement led by the SVP now wants to reverse this deal, saying it was a huge mistake.
Supporters of quotas believe free movement has put pressure on housing, health, education, and transport. They also argue that foreign workers drive salaries down.
The initiative means employers should in future give preference to Swiss passport-holders.
But the Swiss government and business leaders say free movement is key to Switzerland's economic success, allowing employers to choose skilled staff from across Europe.
European politicians' dismay was echoed in some leading newspapers on Monday.
Belgium's Le Soir said "it's the whole scaffolding of Switzerland's bilateral accords with the European Union which is assured of collapse".
And Spain's El Pais said the Swiss had not only questioned their agreement with the EU, but the vote "also reflects the populist and xenophobic agitation sweeping the Old Continent less than three months before the European elections".