National Party's Dan Bidois has won the Northcote by-election, beating Labour's Shanan Halbert by 1362 votes.
The seat was left vacant by former MP Jonathan Coleman when he resigned earlier this year.
More than 11,000 people took up advanced voting, with many others taking to the polls on Saturday.
Voter turnout was relatively high for a by-election, at nearly 20,000. In the last general election 37,311 people voted in Northcote.
On Saturday night, Prime Minister Jacinda Ardern thanked her party for its support of Mr Halbert during the campaign, in particular the Labour candidate's dad, who drove a campaign truck around.
Ms Ardern said she understood the hard work involved in by-elections.
"The spotlight is on you - Michael [Wood, who won the Mt Roskill by-election in December 2016] and I probably can attest to that. But particularly this one, there was a lot of eyes on this and you did us proud, Shanan.
"You worked so hard. You were an excellent candidate. You spoke about the things that mattered.
"You are from this seat and that mattered to this community, so I thank you."
Mr Halbert said the by-election was more about "heart" than anything else.
"Most of all it was about our people and our communities, and I'm so grateful for all of your support in the last four weeks and particularly for today as we got that vote out."
He said he had contact Mr Bidois and congratulated him on his win.
"I have maintained throughout this campaign our humility as a party, but also kept up the responsibility to deliver for our community and ensure that the local leadership that we expect is delivered on.
"I will be there in 2020."
National's Mr Bidois recited a well-worn biography - he's a high school dropout with three degrees, a qualified butcher, a Fulbright scholar, an economist and an Aucklander.
Labour's Mr Halbert has lived in the electorate for seven years and emphasises his opponent's weak spot - Mr Bidois is only a recent North Shore migrant.
Mr Halbert was the most successful Labour candidate to ever go up against Mr Coleman, narrowing National's majority by 11 percent at the 2017 election.
Mr Bidois received 10,147 votes, while Mr Halbert received 8785. The Green Party's Rebekah Jaung was in third place with 579 votes.
The official final vote count, including special and overseas votes, will be released on Wednesday, June 20.