Pollsters said the result shows Labour is in the strongest position it has been in a decade but suggests the Tories have probably clawed back some ground since Liz Truss's administration.
Samantha Dixon, a former local council leader, held the seat for Labour with a 10,974-vote majority, representing a 13.8 per cent swing in the party's favour. She called for an election, claiming Mr Sunak’s government was on “borrowed time”.
Political scientist Prof Sir John Curtice said the result was the best performance by Labour and "the biggest swing from Conservative to Labour in any by-election since David Cameron first walked through the door of Downing Street".
The contest was triggered by the resignation of Labour MP Christian Matheson after complaints of “serious sexual misconduct” were upheld by a parliamentary watchdog.
Mr Matheson, who denied the allegations, was facing a four-week suspension and was asked to resign by Labour before he quit.
Ms Dixon defeated Conservative candidate and NHS nurse Liz Wardlaw, handing the Conservatives a defeat in the first Westminster by-election since Boris Johnson’s forced resignation and the market chaos that ended Liz Truss’s short stint in No 10.
In a victory speech after the result was announced, Ms Dixon said: "People in Chester and across our country are really worried.
"Worried about losing their homes because they can't afford the mortgage repayments or the rent, worried about whether they can put the heating on, worried about whether they can put food on the table for their families.
"This is the cost of 12 years of Conservative government. The government, which has wreaked havoc with our economy, destroyed our public services and betrayed the people who put their trust in them at the last general election."
"The claim of the opinion polls that Labour are well ahead, they are about 20 points ahead, is probably confirmed by the result of this by-election," Mr Curtis said on Friday.
"Albeit things are probably not as bad as the 30-point lead Labour was enjoying in the final days of the Liz Truss administration.
"I think if this by-election had taken place when Liz Truss was prime minister, in her dying days, the swing would almost undoubtedly have been bigger," he said.
"It doesn’t look like Labour are 30 points ahead any more. But they are still 20 points ahead. It is still very substantial."
Prof Curtice said the result shows Prime Minister Rishi Sunak is being reminded by the voters "he still has got a lot of work to do".
Conservative pollster and peer Lord Hayward said Labour "had to be pleased" with the result, but that the Conservatives will be relieved they got more than 20 per cent of the vote.
"It's not quite as bad as the opinion polls had been suggesting," he told Sky News on Friday.
He said there was even a glimmer of hope for Mr Sunak in polls, which shows he is doing better with voters than the Conservative Party he leads.
"He's taken over in incredibly difficult circumstances. He knows what he wants to do. The question is whether he can actually do it. He's got a very slight bounce. The opinion polls showed the Tories were at the bottom of a very deep barrel."
The polls show the Tories have lifted themselves "a bit" he said.
"Rishi comes across to the public at large as managerial. His ratings are way ahead of the Tory Party," Lord Hayward said.
"His ratings, which will worry the Labour Party, are on a par with Keir Starmer, depending on which poll you look at. So he is showing there is potential, but the cost of living and strikes are clearly big issues."
Election officials earlier confirmed that turnout was 41.2 per cent, with 28,541 votes cast.
Labour had been widely expected to hold the seat, having won it in 2019 for the third time in a row with a majority of 6,164.
Labour Party Conference - in pictures
The result is a third recent by-election defeat for the Conservatives.
The previous by-elections, which took place on the same day in June, were a disaster for the Tories, with Labour snatching Wakefield and the Liberal Democrats securing a historic victory in Tiverton and Honiton.