Labour's Gareth Snell, who won 7,853 votes to Ukip's 5,233, said the result showed "hatred and bigotry" were not welcome in Stoke, a former industrial city which has been a safe Labour seat since 1950.
The party's support for staying in the EU put it at odds with the more than two-thirds of Stoke voters who backed Brexit.
But despite that, and Jeremy Corbyn's plunging opinion poll ratings, Labour held the seat with a vote share of 37 per cent - down only two per cent on the 2015 general election.
Labour's comfortable victory in Stoke will go some way to allaying fears that the party is seeing support in its heartlands crumble.
The result will also soften the blow Mr Corbyn received in the Copeland by-election, where his party suffered an historic defeat at the hands of the Conservatives.
Mr Nuttall managed to increase Ukip's share of the vote by just two per cent despite the city's strong support for leaving the EU.
The Conservative candidate, Jack Brereton, was narrowly pushed into third place with 5,154 votes, while the Liberal Democrats finished in fourth place with 2,083 votes. Turnout was just 38 per cent.
“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,” Mr Snell said in his victory speech.
“This city will not allow ourselves to be defined by last year’s referendum. And we will not allow ourselves to be divided by the result.
“Nor will we be divided by race, or faith, or creed.
"Tonight the people of Stoke-on-Trent have chosen the politics of hope over the politics of fear.
“We have said with one voice that hatred and bigotry are not welcome here. This is a proud city and we stand together.”
Mr Snell previously called Brexit "a massive pile of s***” and described Mr Corbyn as an "IRA-supporting friend of Hamas".
Ukip's failure to capitalise on the town’s Euroscepticism will raise questions about the ability of the party – and it’s leader - to build its profile in parliament.
Mr Nuttall's campaign was hit by a series of setbacks, after he was forced to apologise for a false claim on his website that he lost "close friends" in the Hillsborough disaster.
Conceding defeat, he said "Ukip's time will come", adding that he planned to stand as an MP in the 2020 general election.
"I'm not going anywhere," he said.
A spokesperson for Jeremy 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."
A senior party source earlier told The Independent that it would have been “extraordinary” if Mr Nuttall emerged victorious.
As the early hours of Friday morning approached Labour sources were confident of holding the constituency despite a concerted challenge by Ukip.
However, in Copeland, Labour suffered a humiliating defeat after it lost to the Tories by a margin of more than 2,000 votes.