The Tories' majority has been cut from nearly 19,000 to 4,478, with a 10% swing to Labour.
Although votes at mid-term polls are usually lower than at general elections, the 34% turnout was the lowest at a by-election since 2018.
Reform UK - formerly the Brexit Party - came third with 6.6% of the vote, with the party's leader and candidate Richard Tice, describing it as a "massive result". BBC News.
The Green Party and Liberal Democrats both lost their deposits.