The opposition National Party has won the New Zealand election, taking enough seats to form a coalition with its allies on the right wing of politics.
Incumbent prime minister Chris Hipkins, of Labour, phoned National's leader Chris Luxon to concede defeat.
Mr Luxon thanked National voters and said they had "reached for hope" and "voted for change".
It marks a rapid elevation for Mr Luxon, who became an MP in 2020 and National leader only a year later.
The New Zealand Herald reported that National was projected to win 50 seats with around 39% of the vote.
That tally combined with the 11 projected seats of Act, a natural ally on the right, would give it the thinnest of majorities in what looks likely to be a 121-seat parliament.
Labour was projected to win 33 seats, the Greens 13, Act 12, NZ First 8 and Te P?ti M?ori four. Around 96% of votes have been counted.
"I am immensely proud to say that on the numbers tonight, National will be able to lead the next government," said Mr Luxon, a former airline executive, after National's projected victory was announced.
"My pledge to you is that our government will deliver for every New Zealander," he said, adding that he would "build the economy and deliver tax relief".
"We will bring down the cost of living. We will restore law and order," he said.
"We will deliver better health care and we will educate our children so that they can grow up to live the lives they dream of."
However, a National-Act coalition would only have a slim majority, meaning Mr Luxon may need to secure the support of NZ First, whose leader Winston Peters has been kingmaker in previous Labour and National-led coalitions.
Mr Hipkins, who replaced Jacinda Ardern in January, thanked supporters for their campaign work, and said the result was "not one that any of us wanted".
He told party members in the capital Wellington that he wanted them to "be proud of what we achieved over the last six years".
Some of Mr Luxon's key election campaign promises included tax cuts for middle-income earners, a crackdown on youth offending, a ban on phones in schools, and the scrapping of the Labour government's plan to raise fuel taxes.
One of the key issues ahead of the election was the cost of living in a country that has been particularly affected by the slowing economy in China, its largest trade partner, and the war in Ukraine.
"People don't really think that it's doing better than the rest of the world because they are hurting," said local economist Brad Olsen.
The result is a shock for Labour, who under Ms Ardern secured an outright majority in government in 2020 - unheard of under New Zealand's hybrid form of proportional representation.
But Labour has since lost support, with many New Zealanders dissatisfied over surging prices and the country's long Covid lockdown.
The party's losses were significant, with some high-profile members likely to lose their seats. Nanaia Mahuta, the foreign minister, was losing in her constituency with 51% of the vote counted.
"Following on from my good friend Jacinda, it was not going to be an easy task," Mr Hipkins admitted.
"I did know when I took on this job that it was going to be an uphill battle."
"New Zealanders are going to wake up to not only a new day, but the promise of a new government and a new direction," Luxon told supporters in Auckland.
"I cannot wait to get stuck in and get to work because New Zealand has chosen change and we will get this country back on track."
A final result is scheduled to be declared on 3 November.