Labour have held onto the crucial seat of Stoke-on-Trent, brushing aside Ukip leader Paul Nuttall in the process.
Gareth Snell recorded 7,853 votes to retain Labour's seat in the Staffordshire constituency which they have held since 1950.
Mr Nuttall narrowly edged the Conservatives to finish second, polling 5,233 votes, with the Tories on 5,154.
Labour's hold was dampened, however, after it lost a separate by-election in Copeland, a seat the party had held since 1983, to the Conservatives.
Tory victory in Copeland, where turnout was 51.35%, was the first time a governing party had taken a seat from the opposition for decades.
The by-election in Stoke was triggered following former MP Tristram Hunt's resignation to take up a position at the Victoria & Albert Museum.
Speaking in the wake of his victory, Mr Snell said voters had chosen "the politics of hope over the politics of fear".
Voter turn-out in the Staffordshire constituency, however, was only 38.16%.
Mr Snell said: "Our city has been the focus of a media which all too often prefers to dwell on our problems instead of highlighting our achievements.
"But over these last few weeks a city lazily dubbed by some as the capital of Brexit has once again proven to the world that we are so much more than that.
"We have said with one voice that hatred and bigotry are not welcome here. This is a proud city and we stand together."
Mr Nuttall, meanwhile, insisted that Ukip were "not going anywhere" following his defeat, maintaining that the party's "time would come."
"There's a lot more to come from us," he said. "We are not going anywhere, I'm not going anywhere."
Ukip campaigned hard in the constituency in the hope of capitalising on its overwhelming support for Brexit.
During the EU referendum, Stoke voted by more than 69% in favour of a divorce with Brussels.
But Mr Nuttall's campaign was hit by a series of setbacks, including being forced to apologise for a false claim on his website that he lost "close friends" in the Hillsborough disaster.
Labour leader Jeremy Corbyn, who Mr Snell once described as an "IRA-supporting friend of Hamas," congratulated the new MP for Stoke-on-Trent Central.
A spokesman for Mr Corbyn said: "Labour's excellent campaign has won a clear victory in an election Ukip and the Tories threw everything at.
"Stoke has rejected Ukip's politics of division and dishonesty.
"Ukip's claim to represent working class people has been exposed as a sham."
Full election result breakdown:
Gareth Snell (Lab) 7,853
Paul Nuttall (Ukip) 5,233
Jack Brereton (C) 5,154
Zulfiqar Ali (LD) 2,083
Adam Colclough (Green) 294
Barbara Fielding (Ind) 137
The Incredible Flying Brick (Loony) 127
David Furness (BNP) 124
Godfrey Davies (CPA) 109
Mohammed Akram (Ind) 56