By KEVIN TAYLOR and NZPA
Tim Barnett, the architect of prostitution law reform, said after the vote that "right has won".
Surrounded by supporters, he said: "I have to say that we have created what I regard as world-leading law. This is an historic moment.
"We have completed the unfinished business around getting sensible public-health based measures in our legislation."
Mr Barnett said he knew the result when Act MP Heather Roy voted in favour.
"She was the 60th vote."
Key movers included Labour MP Winnie Laban, Ms Roy and National MP Lockwood Smith.
He said several MPs moving their votes influenced the outcome, and he acknowledged lobbying Prime Minister Helen Clark had undertaken in the past few days.
He said the issue was unfinished business from when Helen Clark was Health Minister in the 1980s.
"She's been a very strong supporter of the legislation," he said.
"It has taken quite a lot of pretty intense lobbying, certainly not all by me but by a whole range of people."
Labour MP and former prostitute Georgina Beyer thought her impassioned speech earlier might have influenced the final outcome.
"I really needed to speak from the heart and I guess that's what it was."
Catherine Healy of the Prostitutes Collective said of the prostitutes she represents: "I hope tonight they will be celebrating out there, as only they can."
Prostitutes had supported a marathon decriminalisation effort after three years of scrutiny, 415 hours of debate and 222 public submissions.
She said the collective had new work to do now, including occupational health and safety.
"That's just one example; certainly there are other things that will come up - the Employment Relations Act."
Family Planning Association head Gill Greer said the victory marked the beginning of a new era in prostitution in New Zealand.
"It's going to need a lot of work and a lot of support to change the lot of sex workers in New Zealand."
In his own final plea before Parliament, Mr Barnett asked MPs to vote to remove "the last significant vestige of Victorian moral law from the New Zealand statute book."
Mr Barnett said the issue was the most significant moral debate in Parliament since homosexual law reform 17 years ago.
National MP Nick Smith said the law would mean more prostitutes and more harm. He said Mr Barnett was trying to make sex just another commodity.
United Future MP Larry Baldock said Parliament was passing the cost and responsibility for regulating the sex industry on to local councils.
New Zealand First MP Brent Catchpole predicted a tide of organised crime and said many more women would enter the sex industry under the new law.
His colleague, Pita Paraone, said he had seen enough young Maori women ruined by prostitution.
HOW THE MPs VOTED
Rick Barker (Lab, Tukituki).
Tim Barnett (Lab, Christchurch Central).
David Benson-Pope (Lab, Dunedin South).
Georgina Beyer (Lab, Wairarapa).
Sue Bradford (Greens, list).
Don Brash (Nat, list).
Mark Burton (Lab, Taupo).
Chris Carter (Lab, list).
Steve Chadwick (Lab, Rotorua).
Helen Clark (Lab, Mt Albert).
Deborah Coddington (ACT, list).
Michael Cullen (Lab, list).
David Cunliffe (Lab, New Lynn).
Lianne Dalziel (Lab, Christchurch East).
Rod Donald (Greens, list).
Helen Duncan (Lab, list).
Ruth Dyson (Lab, Banks Peninsula).
Ian Ewen-Street (Greens, list).
Russell Fairbrother (Lab, Napier).
Jeanette Fitzsimons (Greens, list).
Phil Goff (Lab, Mt Roskill).
Mark Gosche (Lab, Maungakiekie).
Ann Hartley (Lab, Northcote).
George Hawkins (Lab, Manurewa).
Dave Hereora (Lab, list).
Rodney Hide (ACT, list).
Marian Hobbs (Lab, Wellington Central).
Pete Hodgson (Lab, Dunedin North).
Parekura Horomia (Lab, Ikaroa-Rawhiti).
Darren Hughes (Lab, Otaki).
Jonathan Hunt (Lab, list).
Sue Kedgley (Greens, list).
Graham Kelly (Lab, List).
Annette King (Lab, Rongotai).
Luamanuvao Winnie Laban (Lab, Mana).
Keith Locke (Greens, list).
Steve Maharey (Lab, Palmerston North).
Trevor Mallard (Lab, Hutt South).
Mahara Okeroa (Lab, Te Tai Tonga).
David Parker (Lab, Otago).
Mark Peck (Lab, Invercargill).
Jill Pettis (Lab, Whanganui).
Lynne Pillay (Lab, Waitakere).
Katherine Rich (Nat, list).
Mita Ririnui (Lab, Waiariki).
Heather Roy (ACT, list).
Ken Shirley (ACT, list).
Clem Simich (Nat, Tamaki).
Lockwood Smith (Nat, Rodney).
Roger Sowry (Nat, list).
Jim Sutton (Lab, Aoraki).
Paul Swain (Lab, Rimutaka).
John Tamihere (Lab, Tamaki Makarau).
Nandor Tanczos (Greens, list).
Judith Tizard (Lab, Auckland Central).
Metiria Turei (Greens, list).
Tariana Turia (Lab, Te Hai Hauauru).
Mike Ward (Greens, list).
Maurice Williamson (Nat, Pakuranga).
Margaret Wilson (Lab, list).
Paul Adams (UF, list).
Marc Alexander (UF, list).
Jim Anderton (Prog C, Wigram).
Shane Ardern (Nat, Taranaki-King Country).
Donna Awatere Huata (ACT, list).
Larry Baldock (UF, list).
Peter Brown (NZ First, list).
Gerry Brownlee (Nat, Ilam).
David Carter (Nat, list).
John Carter (Nat, Northland).
Brent Catchpole (NZ First, list).
Judith Collins (Nat, Clevedon).
Brian Connell (Nat, Rakaia).
Gordon Copeland (UF, list).
Clayton Cosgrove (Lab, Waimakariri).
Brian Donnelly (NZ First, list).
Peter Dunne (UF, Ohariu-Belmont).
Harry Duynhoven (Lab, New Plymouth).
Gerrard Eckhoff (ACT, list).
Bill English (Nat, Clutha-Southland).
Taito Phillip Field (Lab, Mangere).
Stephen Franks (ACT, list).
Martin Gallagher (Lab, Hamilton West).
Sandra Goudie (Nat, Coromandel).
Bill Gudgeon (NZ First, list).
Phil Heatley (Nat, Whangarei).
Paul Hutchison (Nat, Port Waikato).
Dail Jones (NZ First, list).
John Key (Nat, Helensville).
Janet Mackey (Lab, East Coast).
Nanaia Mahuta (Lab, Tainui).
Wayne Mapp (Nat, North Shore).
Ron Mark (NZ First, list).
Murray McCully (Nat, Albany).
Craig McNair (NZ First, list).
Muriel Newman (ACT, list).
Damien O'Connor (Lab, West Coast-Tasman).
Bernie Ogilvy (UF, list).
Pita Paraone (NZ First, list).
Edwin Perry (NZ First, list).
Jim Peters (NZ First, list).
Winston Peters (NZ First, Tauranga).
Simon Power (Nat, Rangitikei).
Richard Prebble (ACT, list).
Ross Robertson (Lab, Manukau East).
Matt Robson (Prog C, list).
Tony Ryall (Nat, Bay of Plenty).
Dover Samuels (Lab, Te Tai Tokerau).
Lynda Scott (Nat, Kaikoura).
Murray Smith (UF, list).
Nick Smith (Nat, Nelson).
Barbara Stewart (NZ First, list).
Georgina te Heuheu (Nat, list).
Lindsay Tisch (Nat, Piako).
Judy Turner (UF, list).
Pansy Wong (Nat, list).
Doug Woolerton (NZ First, list).
Richard Worth (Nat, Epsom).
Dianne Yates (Lab, Hamilton East).
Ashraf Choudhary (Labour).