Legislation to restrict freedom camping passed its final reading in Parliament on Wednesday by 67 votes to 53.
Final stages of the Freedom Camping Bill were debated under urgency because the Government wanted it passed before the Rugby World Cup.
Under the Freedom Camping Bill, councils would be able to fine illegal campers and prosecute them for dumping sewage from their vans.
Conservation Minister Kate Wilkinson says freedom campers are being sent a message that fouling the environment is not acceptable.
The Green Party says the legislation is too heavy-handed.