Until very recently Prime Minister John Key looked set to easily win a third term.
But in recent weeks he has been forced to defend his National Party against allegations of dirty politics and planning mass domestic surveillance.
Mr Key’s personal popularity, however, remains strong among voters, polls show.
On Friday, a New Zealand Herald poll showed the National Party had 48% support. The main opposition Labour Party held 26%, with 11% for the Greens.
New Zealand’s proportional representation electoral system means a coalition government is more likely than any one party winning a majority.
My Key might be forced to rely on New Zealand First’s leader, Winston Peters, to form a government. Mr Peters, who has been in this position before, has not said which way his party will go.
Labour would need to form a coalition with the Greens, their old ally, New Zealand First and potentially the Internet-Mana Party which has been funded by Kim Dotcom, the online billionaire accused of copyright infringement in the US.
Mr Key, a former banker, has campaigned on his strong economic track record and has pledged tax cuts.
Labour leader David Cunliffe has promised to narrow the wealth gap through a capital gains tax and raising the minimum wage.
However, the main policy issues have been somewhat overshadowed by allegations in a book Dirty Politics that National used bloggers to smear opponents. It resulted in the resignation of Justice Minister Judith Collins.
Then Mr Dotcom held an event featuring Edward Snowden, the US National Security Agency whistleblower, and Wikileaks founder Julian Assange, who accused Mr Key of mass domestic spying.
However, Mr Key dismissed the allegations. “There’s been all these distractions and different issues going on but the polling hasn’t really moved,” he told reporters on Friday. “There’s just the natural tightening you get in any [campaign] cycle.”
Polling ends for the 3.4 million eligible voters at 19:00 local time (07:00 GMT) and initial results are expected a few hours later.