Labour leader Jacinda Ardern will be Prime Minister in a remarkable chapter in New Zealand's political history - but the price of that will be wrestling a government that includes NZ First and the Greens.
Ardern's Labour Party was chosen by NZ First leader Winston Peters over National after almost two weeks of negotiations.
It will give NZ First four ministerial posts in Cabinet and an under-secretary post. Peters has been offered Deputy Prime Minister, but is yet to decide whether to take it.
The Greens will not be part of the formal coalition, but will provide confidence and supply and get three ministerial posts outside Cabinet.
Ardern said she was "overwhelmingly humbled" to learn she would be Prime Minister.
Congratulations were quick to flow from overseas - including a phone call from Australia's Prime Minister Malcolm Turnbull, a close friend to former PM John Key.
Turnbull tweeted: "Congratulations @jacindaardern good to talk with you tonight, Look fwd to seeing you soon & building on out two nations' great partnership."
Peters' choice deprived National of the fourth term it had been so close to getting and delivering Labour the government benches after nine years in Opposition.
It was a remarkable turnaround - Ardern had taken over as leader less than two months before the election when its polling was in the low 20s - something Peters acknowledged as showing her mettle and readiness to be Prime Minister.
Ardern said the negotiations had been "robust" but she believed NZ First and the Greens would be "true allies" in achieving what Labour's own goals were.
"Labour has always believed that governments should be a partner in ensuring an economy that works and delivers for all New Zealanders. We also believe in a government that looks after its environment and ultimately looks after its people. I believe Labour has found true allies in Parliament to deliver on that."
The change in government will mean significant changes in some areas - Labour campaigned on housing, poverty, reducing immigration and on the environment.
Ardern also acknowledged English. "I have always believed members of Parliament come to this place in order to do good and serve their country as best they can. Mr English is an absolute example of that and I want to acknowledge it."
Peters had not told either Ardern or English ahead of his public announcement although it is likely news had slipped back to her.
The full detail of the deals is still being negotiated - Ardern said that would happen by early next week and ministerial portfolios announced and ministers sworn in by the end of the week.
She would not say what Labour had to concede of its own policies to secure the support of NZ First and the Greens - including issues such as the water tax.
She said the detailed work on the policy promises was still under way and it was not yet known whether it breached any of Labour's fiscal responsibility commitments - but it had been high in their minds during negotiations.
"I feel extraordinarily honoured and privileged to be in a position to form a Government with Labour at the lead," Ardern said.
She opened her first press conference as prime minister-elect by acknowledging her predecessor in the role, National leader Bill English.
"I want to thank Bill English for the role he has played in this campaign but also as prime minister and as serving in the past as NZ's finance minister," she said.
"Mr English has already called me this evening and acknowledged that negotiations for the National Party have now concluded."
Peters said the decision had not been easy and in some ways it had been "sad" to reject National. However, he said NZ First's priorities were economic reform, issues such as foreign land buyers, immigration and regional development.
"Far too many New Zealanders have come to view today's capitalism, not as their friend, but as their foe. And they are not all wrong.
That is why we believe that capitalism must regain its human face. That perception has influenced our negotiations.
"We've had to make a choice, whether it was with either National or Labour, for a modified status quo, or for change."
That decision brought disappointment for National leader Bill English who said Ardern's progress to Prime Minister was remarkable "given just 10 weeks ago she was deputy leader of a fading Opposition".
English was flanked by wife Mary and senior ministers who now face the move out of the Beehive and back to a normal MPs salary.
Asked if he intended to step down rather than go back into Opposition, English said those matters would be decided in the coming weeks.
"From here, the National Party will regroup. We will have a caucus meeting next week to discuss the outcome we have had here tonight."
He said National's success had ensured it would be "the strongest Opposition party the Parliament has seen".
He said the negotiations with Peters were "satisfactory" and he believed it could have formed a strong Government.
"But all I will say about that is the circumstances meant he had more influence on forming a government than we did."
Asked if he felt robbed given National had secured the highest vote, English said it was MMP and the result was "a legitimate and fair result of the election campaign. We certainly accept it and I'm sure New Zealanders will".
However, he said it was likely many of National's supporters would have believed National should form the government.
"It's an unusual result for MMP - there's probably not been a party anywhere in the world that got 44 per cent of the vote and didn't win the election. But we all know the rules, we campaign according to those results."
He was proud of what the National Government had achieved in its nine years in power, the team he had left - and the shape he had left the country and the economy in.
He also acknowledged New Zealanders, "who we've met and worked with in their businesses and their schools and their homes and in their own communities - the people whose aspiration and quiet heroism has been for all of us a source of energy and direction for change for the better in New Zealand."