The Green candidate, Hannah Spencer, overturned a 13,000 Labour majority to win the Gorton and Denton seat

Keir Starmer is facing an ultimatum from his own party to change direction or see a leadership challenge within months after the Greens humiliated Labour with a historic byelection victory in Gorton and Denton.

Overturning a 13,000 Labour majority from the general election, Hannah Spencer, a local plumber and Green councillor, became the party’s fifth MP on Friday. Reform UK’s Matt Goodwin was second, just ahead of the Labour candidate, Angeliki Stogia.

The scale of defeat in an area which had returned Labour MPs for nearly a century, and where Starmer’s party still believed it could win even on polling day, plunged his ministers and MPs into renewed despair just weeks after he saw off a challenge to his position.

While only a handful of backbenchers called openly for Starmer to depart in the wake of the result, even loyal ministers said the surge in Green fortunes under the leadership of Zack Polanski meant the prime minister had to address an exodus of Labour voters from its left flank.