Labour has won the Wakefield by-election with 13,166 votes – a majority of 4,925 – taking the traditional Red Wall seat back from the Conservatives.
NHS worker Simon Lightwood will now represent the West Yorkshire city in the Commons.
Speaking after the result, Mr Lightwood said people were “sick of the deceit and dishonesty of this government”.
“Boris Johnson, your contempt for this country is no longer tolerated, your government has no ideas, no plan to address the big issues facing our country,” he said.
He also pointed to issues of poverty and NHS waiting times.
“People in Wakefield and across the country are sick of the deceit and dishonesty of this government,” he added.
The ballot was triggered by the resignation of Tory MP Imran Ahmad Khan, who quit after being found guilty of sexually assaulting a 15-year-old boy.
The seat had been represented by Labour since 1932, but was taken by Mr Khan in Boris Johnson’s 2019 landslide general election win.
The result is the first test of the prime minister’s leadership since last month’s confidence vote.
The Conservatives also appeared to be heading for a defeat in the Tiverton and Honiton by-election as the Liberal Democrats claimed an “historic victory” – though counting is still under way.