Thirty-seven-year-old Labour leader Jacinda Ardern is set to become New Zealand's next prime minister, 26 days after the country went to the polls.

Kai Schwoerer / Getty Images

Ardern will become the country's second-youngest prime minister and the third woman to hold the top job.

"This is an exciting day," Ardern said in a statement on Thursday.

"We aspire to be a government for all New Zealanders and one that will seize the opportunity to build a fairer, better New Zealand.

"We will work hard to ensure New Zealand is once again a world leader, a country we can all be proud of. We said we could do this; we will do this."

In the 80 days since she took over the Labour leadership, Ardern has created a groundswell of support dubbed "Jacindamania".

Ardern told BuzzFeed News in the lead-up to the election that she won't be a "politics as usual" prime minister.

"I approach things differently," she said. "I am quite collaborative in the way I want to do things. I don't want to bring politics as usual, so there is some benefit to the age and the experience I bring to the table as well."

Ardern learned she would become prime minister at the same time as the rest of New Zealand, watching NZ First leader Winston Peters’ speech live on national television.

Phil Walter / Getty Images

After weeks of negotiations, Peters revealed on Thursday afternoon that his party would be entering into a coalition government with Labour, ending the National party's nine years in office.

"The people of this country did want change," Peters told a press conference on Thursday afternoon. "And we have responded to that."

Peters didn't tell Ardern or National leader Bill English about his decision in advance because he thought the public had the right to know first.

"No doubt she saw it on the television," Peters quipped about Ardern, who he said displayed "extraordinary talent" during the campaign.

It took nearly four weeks for NZ First's caucus and board to reach a "substantial consensus" on the policy concessions offered by Labour in return for its support in forming a government.

The exact details of the Labour/NZ First coalition deal have not been released, but Peters said it will include a plan to build 10,000 affordable homes each year.

Getty Images For Tvnz / PR IMAGE

NZ First leader Winston Peters

Under New Zealand's mixed-member proportional (MMP) system, to form a government a party or coalition needs at least 61 seats in the 120-seat, unicameral parliament.

In the final results count, National picked up 56 seats, Labor 46, and the Greens eight. New Zealand First won nine seats, giving it the balance of power and position to decide who would lead the country.

Labour will need the support of the Greens party, as well as NZ First, before it can form government.

Peters didn't say what job he will take in the 52nd government. He said the distribution of ministerial roles will be up to the new prime minister, but hinted he had been offered deputy prime minister.

Alice Workman is a political reporter for BuzzFeed News and is based in Canberra.