Labour secured a by-election victory in Corby as the party declared the road to Downing Street ran through the seat.

In what had been billed as the first real electoral test for Ed Miliband's leadership, Labour took the Northamptonshire seat with a resounding 8000 majority – a swing of more than 12%.

Since its creation 30 years ago, no party has formed a Government without taking the constituency.

The town, nicknamed "little Scotland" because of the huge number of Scots who moved to take jobs in its steelworks, is seen as a bellwether and has often changed hands between Labour and the Conservatives.

Aware they were facing defeat the Tories appeared to capitulate just minutes after the polls closed on Thursday night.

The outgoing MP, Louise Mensch, tweeted that the result was no reflection on the Conservatives or the local candidate. It was instead, she said, a reaction to her decision to quit mid-term to relocate to New York.

But newly elected Labour MP Andy Sawford said the result was a message to David Cameron and a damning verdict on the PM's "betrayal of the British people".

Pointing to the constituency's history of returning MPs to form the government party, he told supporters the "road to Downing Street runs through Corby".

However, he said Labour still had much work to do before the next election to show that it understood voters' concerns.

The result is the first time in 15 years that Labour has taken a seat from the Tories in a parliamentary by-election.

Corby did not suffer the low turnouts seen in other parts of England where voters were picking local police commissioners.

In the end, 44% of the electorate cast a vote in Corby, a respectable percentage in a mid-term by-election held in November.

In an attempt to manage expectations, the Conservatives had briefed before the result that anything less than an 11,000 majority would be a setback for Ed Miliband.

But Mr Miliband also insisted the people of Corby had delivered a clear message.

"Middle England is turning away from David Cameron and the Conservatives, because middle England feels let down by Mr Cameron and the Conservatives", he said.

Mr Cameron should listen to voters and scrap unpopular policies, he said.

Mr Cameron dismissed the loss as a "classic mid-term result" and pointed to the fact that at the same time as it took Corby, Labour also lost the election for a new mayor of Bristol.

Mr Sawford won 17,267 votes, to Conservative candidate Christine Emmett's 9476, overturning a Tory majority of 1951 in the 2010 General Election.

The Liberal Democrats suffered humiliation as they were beaten into fourth place by UKIP.

The Labour party also won by-elections in the safe seats of Cardiff South and Penarth and Manchester Central.