Fifty-two percent of voters backed the "Stop Mass Immigration" proposal, while 40 percent are against it, pollsters Isopublic said on Thursday.
The margin of error was 4.2 percent.
The quota plan was crafted by the right-wing populist Swiss People's Party (SVP) — the largest in parliament.
The SVP claims that Switzerland has lost control of its own immigration rules, with disastrous results for the economy and society such as undercutting local workers, driving up rents and land prices, and overburdening the health and education systems.
The Swiss government and parliament have both rejected the plan, arguing that foreign workers have long been crucial to the economy of one of the world's wealthiest nations.
But under Switzerland's system of direct democracy, voters have the final say on a host of issues.
Some 1.9 million of the eight million people currently living in Switzerland are non-Swiss — 3.3 percent more than in 2012, according to official data.
The highest numbers of recent immigrants come from Portugal, Kosovo, Germany, Italy and France.
Switzerland is not a member of the European Union but has tight economic ties with the 28-nation bloc.
It axed immigration quotas for EU citizens in 2007, giving them equal footing on the job market as part of a raft of accords with Brussels.
The referendum proposal calls for the quotas to be reimposed, raising the spectre of a clash with Brussels because it sets a three-year deadline for the rules to be renegotiated.
It would also set quotas for people who live in neighbouring France, Germany, Italy and Austria but work in Switzerland.
Cross-border workers are a hot topic after recent local elections saw major gains for the Geneva Citizens' Movement, a party that claims they take jobs from Swiss residents.
The proposal also calls for the constitution to state clearly that immigration must serve the country's economic interests and guarantee the Swiss priority on the labour market.
Over and above the quotas, it stipulates that would-be immigrants must have a job offer, sufficient financial resources to get by, and be willing and able to fit in to Swiss society.
The quotas would also apply to asylum seekers.
A vote is also due by 2015 on a separate proposal by campaigners who say immigration limits are needed to rein in overpopulation and protect the environment.