Swiss voters rejected an initiative that would have prevented EU citizens from being able to freely work and live in the country.
The Swiss government said the the initiative had failed with 61.71% voting against it in Sunday's referendum.
The initiative, brought by the far-right Swiss People's Party, sought to limit immigration after a 2014 referendum to bring quotas back was scaled down by the Swiss parliament.
Nearly 25% of Switzerland - 2.1 million people - are foreigners, of which the majority (1.4 million people) come from the European Union and the United Kingdom. Meanwhile, some 460,000 Swiss citizens live in EU countries.
A yes vote on the referendum would have derailed the country's relationship with the European Union by triggering a so-called guillotine clause that would terminate seven bilateral agreements including one on trade with the bloc.
European Council President Charles Michel said it was a "great day" for EU-Swiss relations.
"We welcome the results of the popular vote and look forward to continuing our close cooperation. The Swiss people have spoken & sent a clear message: together we have a great future ahead of us," Michel tweeted.
Speaking to Euronews, Swiss voter Frédéric Martin said: "I really think we have to be open minded and to accept that people from abroad are at least as valuable as us and can do good work in our country and improve the economy."
Martin, who lives in the canton of Valais, planned to vote no on the initiative but said that he knew many people who planned to vote yes.
Voters accept two week paternity leave; Geneva implements a minimum wage
Meanwhile, voters have accepted a referendum that gives fathers two weeks of paternity leave with around 60% voting yes on the initiative.
Switzerland being one of the only European countries where paternity leave is not guaranteed.
Swiss voters also agreed for the government to spend CHF 6 billion (€5.5 billion) on updating fighter aircraft.
They rejected changes to the hunting law that would have allowed townships to better control wolf populations and rejected an increase to the maximum childcare tax deduction.
Locally, Geneva voted to implement a minimum wage of 23 Swiss francs (€21) per hour.