The measure will leave Austria with some of the toughest asylum laws in Europe.
It comes after a far-Right candidate, Norbert Hofer, won the first round of the country’s presidential election, running on an anti-migrant message.
The passage of the law also comes against the backdrop of a row with Italy over Austria’s plans to impose new controls on the border between the two countries.
As Austrian MPs debated the new measures, Matteo Renzi, the Italian prime minister, said that Vienna’s frontier proposal was “shamelessly against European rules”.
Under the new law, Austria will declare an emergency over migrant numbers. Asylum-seekers will then have their claims assessed at the border before being allowed to enter. Almost all will be refused and turned away.
Only those with immediate family already in Austria – or who can prove they are in danger in neighbouring transit countries – will be allowed in.
Otherwise, Austria will assume they are able to claim asylum in whichever neighbouring country they arrived from.
“We cannot shoulder the whole world’s burden,” said Wolfgang Sobotka, the newly appointed interior minister. “So many other EU members are not doing their part.”
The new measures were agreed by the Austrian government earlier this year, after its attempt to impose quotas on asylum-seekers was ruled illegal by its own commission of experts.
But Wednesday’s vote assumed new significance after Norbert Hofer of the far-Right Freedom Party (FPÖ) won the first round of the presidential election.
Mr Hofer, who carried a Glock pistol around with him on the election trail, campaigned on an anti-migrant platform.
The government will hope the tough new measures will go some way to clawing back support from the Freedom Party before 2018’s general elections.
The far-Right party has been regularly polling 30 per cent support.
But in the more immediate future, the new measures will pit the government against the only man who can now stop Mr Hofer from securing the presidency.
Alexander van der Bellen of the Green Party, the only other candidate in next month’s run-off election, is largely pro-refugee and has opposed the government’s attempts to limit migrant numbers.