The bill's purpose was to authorise Auckland Council to make bylaws prohibiting prostitution in specified public places.
It had been slow to progress because it was expanded to cover Auckland when the Super City was created.
The council wanted to target three specific areas - in Otahuhu, Manurewa and at Hunters Corner in Papatoetoe. It said prostitution law reforms in 2004 did not give it the power to regulate street prostitution.
Speaking in Parliament before the vote, Labour's Annette King said the long-running debate was started in 2005 when a bill was submitted by former Manurewa MP George Wilkins.
"So much time has gone into this issue...we have had report after report," Ms King said.
Before the election a parliamentary committee heard legal advice and concluded Auckland Council could ban street workers from specific areas with local laws.
"We think it is time to stop 10 years of Parliament's time and money, and say to the Auckland Council - pass a bylaw, because you can. If that's what Auckland wants to do, just get on with the job."
National's Scott Simpson said he encouraged and invited Auckland Council "to pass the bylaw which they so clearly can if they so choose to do so".
NZ First's Tracey Martin said experience demonstrated council's struggled to enforce bylaws against prostitution.
"It is a cop out, quite frankly, to rely on what is a theoretically true statement - that a bylaw can be created...because, then it must be enforced."