The Nationals' David Layzell is on track to hold the Upper Hunter for the NSW coalition, defying expectations of a swing against the government in the crucial by-election.
NSW Nationals leader John Barilaro trumpeted a victory on Saturday evening.
"It was the whole world versus Dave Layzell and tonight the booth counts have come in and we've been rewarded with the support of the people and the voters of the Upper Hunter," he said on his Facebook page.
Mr Layzell has not yet claimed victory.
Counting of the votes resumed at 9am on Sunday. With more than 30,000 votes counted, Mr Layzell had 31.22 per cent of first preference votes, with Labor's Jeff Drayton on 20.83 per cent.
Postal votes could be returned as late as Wednesday. The outcome of preference counts may not be known for some days.
Mr Barilaro told Sky News on Sunday the result was a repudiation of the Labor party and former prime minister Malcolm Turnbull, who had endorsed independent candidate Kirsty O'Connell.
Labor was "pretending to be for mining or agriculture" in the Upper Hunter but voting against the government's policies in Sydney, he said.
The deputy premier said the Nationals had been assisted by premier Gladys Berejiklian's popularity. The federal government's announcement this week that it would bankroll a new gas power plant in the Hunter was also timely, he admitted.
Mr Turnbull has congratulated the National Party on Twitter for retaining the seat. He says it's a tribute to the great work of the NSW Liberal government through the pandemic.
The major parties have been sweating on the result, which was destined either to push the Berejiklian government into minority or increase pressure on Jodi McKay as opposition leader.
Her position has been under pressure and the result could force her leadership to the brink.
Labor suffered a negative swing of around 8 percent from the 2019 race, when they got 28.6 per cent of first preferences.
The Nationals held the seat by 2.6 per cent before MP Michael Johnsen's resignation over sexual assault allegations and a sexting scandal prompted the by-election.
Mr Johnsen denies the allegations and has not been charged.
The by-election contest has centred on the future of mining in the region, with the Greens' Sue Abbott wanting to move the region away from its reliance on coal.
But Labor and the Nationals have talked up their coal credentials and Labor's Mr Drayton is a former coal miner.
In a last-ditch appeal to voters, Mr Drayton said he would fix years of neglect suffered under the Nationals, who have held the seat for more than 90 years.
"I'm ready to go - ready to go to Macquarie Street and fight for people of the Upper Hunter's fair share," he said while campaigning on Saturday.