Labour has chosen Andrew Little as its new leader.
Mr Little, who emerged the winner after a tight battle that went into a third round of voting, said it was an "immense privilege" to have been chosen.
"Labour is the party that has always been at the forefront of real and meaningful change that benefits all New Zealanders and that is the tradition I will honour as leader."
He thanked his rivals, Grant Robertson, Nanaia Mahuta and David Parker, saying "my appreciation of their talents and skills has redoubled since we've been on the road these last few weeks".
He said his job now was to ensure this was National's final term.
FROM THE ARCHIVES: Michele Hewitson's 2010 interview with Andrew Little
"The current Government has shown its disdain for New Zealanders with its attacks on Kiwis' rights at work, their right to privacy, and in its moves to sell our housing assets and its mistreatment of the families of the Pike River disaster.
"It is becoming clearer by the day that this must be their last term and I am confident that by drawing the movement together we can achieve that aim. I look forward to leading the change."
The party tweeted its congratulations:
Mr Little had 29 per cent support after the first round of voting - well behind his main rival, Mr Robertson, who had 37 per cent.
However, he overtook Mr Robertson in second round when he picked up Ms Mahuta's second preference votes. He also got some of Mr Parker's in the third round - pushing him over the critical 50 per cent mark.
Mr Little secured only 16 per cent of the caucus votes in the first round, with Mr Robertson on 44 per cent. However, Mr Little's caucus tally lifted to 44 per cent by the third round. He was saved by strong support from the unions.
Mr Little was greeted with a round of applause by other caucus members when he walked into the caucus room for the announcement. He said he did not underestimate the job ahead and was determined to ensure there was discipline and unity.
Asked if he believed he could unite caucus given Mr Robertson had much stronger caucus support, Mr Little said caucus all understood the message the election had delivered.
He denied he did not have a strong mandate saying he had won the contest fairly and hoped the other contestants would be part of his leadership team.
Asked how he had got the edge, he said that on the hustings people were clear they wanted a change - "I think that and the bubbly personality," he joked.
He would not say who he would like as his deputy and wanted to talk to his colleagues before deciding who would be in what positions. He expected his front bench would be "reflective and representative of New Zealand".
Labour president Moira Coatsworth, who announced Mr Little's victory, said he would lead a reinvigorated party into the 2017 election campaign.
"Andrew has the leadership skills and the vision to win the trust of New Zealanders and take Labour to victory in 2017. I have no doubt he will go on to become a great Labour Prime Minister who builds a stronger, fairer and more sustainable New Zealand."
On the campaign trail: Andrew Little, David Parker, Grant Robertson and Nanaia Mahuta. Photo / Jason Oxenham
Mr Robertson ruled out contesting the leadership again in the future, saying he had now tried twice and failed so he would give up on his aspirations.
He said there was no hiding the fact he was disappointed, but he would support Mr Little and congratulated him.
"I can give a total commitment I will not be putting my name up again."
He did not believe there was a chance he would win on a recount but expected the numbers to be checked. "There is almost no room for error though."
He dismissed the suggestion Mr Little did not have a mandate because of his comparatively low support in caucus, saying the leadership contest process meant nobody could be leader without a significant degree of support.
"Of course I'm disappointed in the result."
Mr Parker has also ruled out being either deputy leader or finance spokesman again. He said that was not personal to Mr Little - he had told caucus before the leadership contest that he would not do finance again.
Asked if it was possible he would leave Parliament altogether, he said: "I have no plan to."
Green Party co-leader Dr Russel Norman said his party looked forward to working with Mr Little. "We share common ground with Labour in a number of important policy areas. We look forward to continuing to build a constructive working relationship with Labour and to help make New Zealand a better, fairer place to live," he said.
Mr Little's former employer, the Engineering, Printing and Manufacturing Union, said he had what it took to be a "strong and successful leader".
Bill Newson, who succeeded Mr Little as EPMU national secretary, said: "Our national executive unanimously endorsed Andrew because of his experience, ability, and dedication to the rights of working New Zealanders."
Mr Little is Labour's 15th leader in the party's 98-year history.
- With NZME. and Isaac Davidson