Democrats flipped a key swing seat in New Hampshire on Tuesday, taking them within a whisker of denying Republicans control over the state's House of Representatives.

Hal Rafter defeated GOP candidate Jim Guzofski to seize Rockingham County's 1st District by 56 percent of the vote to 44 percent, despite the constituency having narrowly voted for Donald Trump in the 2020 presidential election.

New Hampshire voted decisively for Joe Biden at the 2020 presidential election, and narrowly backed Hillary Clinton over Donald Trump in 2016.

Any sign the state was moving away from the Democrats would have been a major blow to Biden's 2024 re-election hopes and a win for Trump, who polling shows is the firm frontrunner for the 2024 Republican presidential candidacy.

After Rafter is sworn in, the Republican majority in the New Hampshire House will fall to just 198-197, with the chamber also containing two independents and three vacant seats.

The election for one of these, to replace Democrat David Cote in a strongly Democratic leaning district, is due to take place on November 7. Should a Democrat win this, as is expected, it will force a tie in the chamber.

House Democrats have won eight of the last nine specials, and this red-to-blue flip is another step towards reclaiming control of the New Hampshire House.

Responding to the win Laura Telerski, chairman of the House Democrats Victory Campaign Committee, commented: 'The results tonight in the towns of Northwood and Nottingham speak for themselves: Granite Staters resoundingly reject Republican extremism and are motivated to vote for change in record numbers.