Another officer was seriously injured. The shooter fled the scene in a vehicle and it's not known if he's been caught.
Around four hours after the shooting, armed police stormed a house and arrested two men, local media said.
Police in New Zealand do not normally carry guns, and it is rare for officers to be killed in the line of duty.
According to the police, the last was in May 2009, when a senior constable was shot at a house in Napier while carrying out a routine search warrant.
In Massey, west Auckland, cordons are in place after Friday's shooting, and schools were told to lock down.
A member of the public was hit by the suspect's car and has minor injuries.
Police Commissioner Andrew Coster confirmed the officers were not armed at the time.
"At this stage there is nothing to indicate that this job was going to be anything out of the ordinary," he said.
"The incident points to the real risk that our officers face as they go about their jobs every day," he added.
Prime Minister Jacinda Ardern said the death was "devastating news".
"Our police officers work hard every day to keep us and our communities safe," she said.
One witness told the NZ Herald he saw an injured officer jumping over a fence.
"He dropped to the ground and was looking around a bit, clutching his chest," the man said. "Then he jumped over the fence and ran off up the street."
Only this month, New Zealand Police said a six-month trial of "armed response teams" would not continue.
"I want to reiterate that I am committed to New Zealand Police remaining a generally unarmed police service," said Mr Coster.
"How the public feels is important - we police with the consent of the public, and that is a privilege."
More about: #NewZealand