Labour’s shadow Scotland secretary has hailed the result after Kim Leadbeater won by just 323 votes after a bitter and divisive campaign that many had predicted the party would lose.
She secured the seat – which Labour held at the 2019 general election with a 3,525 majority – with 13,296 votes, narrowly beating Conservative Ryan Stephenson on 12,973.
Veteran left-winger George Galloway, who had targeted the constituency’s Muslim voters in a campaign to topple Sir Keir, was third with 8.264.
Now Mr Murray has praised the new MP, whose victory came despite a divisive anti-Labour campaign run by Mr Galloway.
He said: "I'm delighted for Kim who will be a fantastic MP and this result shows that people want representatives who will work to bring people and communities together rather than setting them off against each other.
"The old politics of division has been defeated and there is a lesson for us all in that.
"While our opponents both in Scotland and across the UK want to focus on divisions between us, Labour will win by focusing on what unites us and delivering on community priorities."
The Edinburgh South MP also hit out at Mr Galloway, who had promised to eat his hat if Labour didn’t come third.
Mr Murray said: “Galloway’s disgusting and divisive politics have been rejected again by voters.
"While he is eating his hat he should reflect on why his attempt to tear a community apart has failed.”
The result is a personal triumph for Ms Leadbeater, with her sister Jox Cox having been the seat MP until her murder by a far-right extremist in 2016.
Speaking afterwards, Ms Leadbeater said: “She knew how capable I was. So she’d be absolutely delighted that I’ve got to this point.
“And if I can be half the MP that she was, then I’ll be doing a good job.”
Ms Leadbeater said she hoped to heal the divisions in the constituency after a gruelling by-election campaign.
She said: “Sadly we have seen some nastiness during this by-election campaign and there are some divisions that need to be healed. I think that if anyone can achieve that I can.”
Sir Keir claimed Labour’s triumph was a “victory of hope over division”.
Arriving in the constituency to celebrate, Sir Keir praised Ms Leadbeater’s courage in standing.
“This campaign has been tough because others have poisoned it with hatred, with division and finding difference and misinformation, with lies and harassment and threats and intimidation,” he told supporters.
“That that should have happened in Batley & Spen in all places is disgusting. That that should have happened to Kim of all people is unforgivable.
“All those who engaged in it and all those who didn’t call it out – they should be utterly ashamed of themselves.”
Conservative Party co-chair Amanda Milling said the result was “disappointing”, but insisted it was not a “great win” for Labour.
“This was always going to be really a tough battle for us,” she told Sky News.
"Governing parties don’t tend to win by-elections. This is a Labour hold, not a Labour gain.”