The Government says the passing of a new law gives it the tools to deal with a mass arrival of asylum-seekers.
The Immigration Amendment Bill passed its final reading in Parliament by 63 votes to 53 on Thursday evening and was opposed by the Labour, Mana and Green parties.
Under the legislation, any incoming group of more than 30 people can be detained for up to six months.
The law also enables the status of refugees to be reassessed after three years, and before they can apply for permanent residence.
Immigration Minister Michael Woodhouse says the change ensures the immigration system will be able to handle a mass arrival of asylum seekers.
He says New Zealand is a growing target for asylum seeker boats from Asia and it's only a matter of time before one arrives.
Mr Woodhouse says people smugglers are becoming more sophisticated and have better resources and navigation tools, and they need to know that New Zealand isn't a soft touch.
But Labour MP Darien Fenton says the Government is over-reacting to a non-existent problem.
She told Parliament it is ridiculous to think that a boat could make it to New Zealand without stopping somewhere.
Amnesty International says the legislation breaches New Zealand's international obligations and the United Nations' refugee convention, and was opposed by the Human Rights Commission and the UN High Commissioner for Refugees.
Executive director Grant Bayldon says people who fear persecution have a fundamental legal right to seek asylum. "This is a bill that is not needed and will not be effective, and worse than that, breaches the human rights of people at their most vulnerable who are seeking protection."