Britain's opposition Labour Party retained a parliamentary seat in the northwest of England on Friday, comfortably winning the vote in the first electoral test for Rishi Sunak as prime minister.

Labour candidate Samantha Dixon won the City of Chester constituency, securing 61% of the vote, compared to 22% for the candidate from Sunak's Conservatives. Labour's outright majority rose to 10,974 from 6,194.

The scale of the defeat offers the first electoral judgment on the Conservatives after a chaotic few months where Boris Johnson and Liz Truss were both ousted as prime minister, the latter after markets were spooked by her fiscal plans.

Sunak became prime minister on Oct. 25, taking leadership of a divided and fractious party at a time of economic crisis, tasked with tackling the impacts of soaring inflation and restoring financial markets confidence.

Governing parties rarely do well in so-called by-elections, which take place outside the schedule of national elections when a lawmaker leaves their position. The next national election is expected in 2024.

British polling expert John Curtice said the 13% swing from Conservative to Labour in Chester confirmed the trend seen in national polls, where the main opposition party are around 20 points ahead of Sunak's governing party.

Curtice said the scale of the swing could indicate Labour winning an outright majority in parliament at the next national election, but noted that local elections were rarely a good guide.

"Rishi Sunak is being reminded by the voters of Chester that he's got quite a lot of work to do to get his party back in a position where we might consider the prospect of the Conservatives willing the next general election," he told BBC Radio.

Labour have held the Chester seat since 2015, when it was the most marginal seat in the country. It was held by the Conservatives between 2010-2015.

By-election defeats earlier this year in two previously Conservative held seats led to the resignation of the party's chairman and contributed to the pressure on Johnson.

The by-election was triggered after Labour lawmaker Christian Matheson resigned. An independent panel said he breached parliament's sexual misconduct policy for making "unwanted and unwelcome" advances towards a junior staff member. (Reporting by Alistair Smout, William James and Kate Holton Editing by Raissa Kasolowsky)