Gordon Brown today survived his latest by-election test when Labour comfortably cruised to victory in the Glasgow North East by-election.
It won the seat made vacant by the resignation of former Commons Speaker Michael Martin with a majority of 8,111 over the SNP.
Despite widespread predictions that the far-right British National Party would do well, by putting the Tories into fourth place and saving its deposit, in the event it did neither.
The Tories' Ruth Davidson pushed the BNP's Charlie Baillie into fourth place. She gained 1,075 votes to his 1,013.
The result will have come as a considerable relief to the Prime Minister after the humiliation of seeing Glasgow East fall to the nationalists last year and seeing Norwich North fall to the Tories in July.
Mr Brown had taken the risk of campaigning in the constituency.
And in his victory speech, Labour's Willie Bain declared: "This is a great day for Labour. This is a resounding victory for Gordon Brown and Labour. This by-election has been about many things but most of all it has been about jobs and the economy.
"Tonight people have had their say. They have backed Gordon Brown in his efforts to secure our economic recovery, they have sent a resounding 'No' to (SNP leader) Alex Salmond and his treatment of our great city and a resounding 'No' to David Cameron."
Beaten SNP candidate David Kerr, a former BBC journalist, told supporters: "Our message through the campaign was simple.
"For all the problems this constituency and this country face, our potential is far greater still.
"But it is a potential that will only be achieved through freedom."
And Alex Salmond said: "David Kerr achieved progress in what is the Labour Party's safest seat in Scotland, despite a relentlessly negative Labour campaign.
"He did chalk up the SNP's best share of the vote in this constituency for 35 years.
"Of course we are disappointed not to do better and will reflect carefully on the result and the lessons to be learnt."
BNP candidate Charlie Baillie was booed and heckled when his turn came to speak.
Above the din, he insisted his party had shown it was a credible alternative.
But he was dogged by cries of "Nazi scum" and "scum of the earth" and these continued after he left the platform and was making his way out of the count in Glasgow.
Before the result was declared, he said: "I believe in this contest we have shown to the voters of Scotland that we are a credible alternative.
"I take from this contest a positive message that we can go forward with this result to win a seat in the Holyrood Parliament in 2011, which is our long-term objective."
The result came at a considerable relief to Labour in Scotland after the mauling last year in Glasgow East, the next door constituency.
Mr Salmond, meanwhile, had promised a "brammer" - or belter - of a campaign but had studiously avoided rash predictions of victory.
SNP MP Stewart Hosie said earlier: "We are on course to achieve our best result in this constituency for 35 years. It appears this has not been enough to take the seat from Labour with a record low turnout of 33 per cent."
Labour MP Ian Davidson said: "I think this is a very good result for Labour to do so well under all the circumstances.
"People in this constituency have stuck with us because they recognise that what we are doing nationally and in Scotland is the best thing for them.
"Particularly at a time of economic difficulty, the fact that none of the opposition parties have managed to get much traction gives us a great deal of hope going forward to the General Election."
Willie Bain (Lab) 12,231 (59.39%)
David Kerr (SNP) 4,120 (20.00%)
Ruth Davidson (C) 1,075 (5.22%)
Charlie Baillie (BNP) 1,013 (4.92%)
Tommy Sheridan (Solidarity) 794 (3.86%)
Eileen Baxendale (LD) 474 (2.30%)
David Doherty (Green) 332 (1.61%)
John Smeaton (Jury Team) 258 (1.25%)
Kevin McVey (SSP) 152 (0.74%)
Mikey Hughes (ND) 54 (0.26%)
Louise McDaid (Soc Lab) 47 (0.23%)
Mev Brown (Ind) 32 (0.16%)
Colin Campbell (TILT) 13 (0.06%)
Lab majority: 8,111 (39.38%)