Barnaby Joyce has claimed a stunning win in New England with what the Prime Minister Malcolm Turnbull has touted as the biggest byelection swing to a sitting government in Australian federal political history.

In what will be a major shot in the arm for the government and could restore some confidence after a grim few weeks, Mr Joyce appears to have lifted his primary vote by at least 10 points, meaning after the distribution of preferences he will have as many as seven in 10 votes in the NSW seat.

That represents a swing of at least 11 per cent and possibly as much as 14 per cent on a two party-preferred basis compared with the 2016 election.

It comes despite the government's flaccid fortunes lately and the unusual circumstances of Mr Joyce losing his seat to the citizenship crisis.