By Peter Wilson
Parliament has passed the bill that allows the flag referendum process to take place.
Opposition parties fought it to the last minute.
"This bill is a dog and it should be rejected," said Labour's Trevor Mallard.
"It's the Prime Minister's vanity project... in a way, seeing John Key lose is going to be fun."
Mr Key favours a new flag but opposition parties believe there will be a strong vote against changing it.
Deputy Prime Minister Bill English said public debate around changing the flag would take off now the bill had been dealt with.
"We're moving out of those swirling political rivers to a sunny upland where New Zealanders will get to decide what symbol stands best for their country and their identity."
The bill passed its third reading by 63 votes to 56.
The Flag Consideration Panel announced on Monday it had narrowed down the more than 10,000 submitted designs to 40.
There will be further checks and verifications before the list is cut down to four.
The panel says it selected designs it felt best represented the range of suggestions received.
The Union Jack isn't on any of the 40 designs.
WHERE TO FROM HERE FOR A NEW FLAG?
* Mid-August - mid-September: Final design review to determine the four alternative flag designs to be included in the first referendum
* Late 2015: First referendum will be held for voters to choose their preferred alternative flag design
* April 2016: Second flag referendum, a run-off between the current flag and the top-ranked alternative.