Liberal Democrat leader Nick Clegg has hailed his party's success in the Eastleigh by-election, telling activists in the Hampshire town: "We held our nerve, we stood our ground... we overcame the odds and we won a stunning victory."
The Lib Dems held off a late surge by the UK Independence Party (Ukip) to win the by-election in the early hours of this morning, but Prime Minister David Cameron was dealt a serious blow as the Conservatives were pushed into third place.
Cameron acknowledged that the result was "disappointing" for his party but insisted he was "confident" that in the 2015 general election the Tories would be able to win back the protest voters who deserted them last night.
Speaking in 10 Downing Street, the Prime Minister said: "It is a disappointing result for the Conservative Party, but it is clear that, in mid-term by-elections, people want to register a protest.
"But I am confident that at the general election we can win those people back by demonstrating that we are delivering for everyone who wants to work hard and wants to get on. That is what we will be focused on."
Visiting Eastleigh to congratulate his party's new MP, Mike Thornton, Clegg said the message for Lib Dems from the poll was that "we can be in government and still win".
Thornton won the by-election - triggered by the resignation of disgraced ex-Cabinet minister Chris Huhne - with 13,342 votes, a majority of 1,771 over Ukip's Diane James, who said beating the Tories was a "humongous" shock which represented a "seismic shift" in UK politics.
Jubilant Lib Dem president Tim Farron said the result meant that 20-30 Tory seats were now vulnerable to the party in the 2015 general election.
But Conservative Education Secretary Michael Gove insisted that the party would not be blown off course by its defeat and would resist backbench calls for a shift to the right on issues like immigration and gay marriage.
"What we need to demonstrate is that the course that we have set is producing results," Gove told the BBC Radio 4 Today programme.
"If people think you are changing policy in order to take account of a by-election or to play party politics, that is when the problems arise and people think 'Do you know what? We smell inauthenticity here'."
In a Twitter message as the result was announced, Clegg said his party was "on track" for the 2015 election.
The Eastleigh poll was a massive test for the Lib Dems, after Huhne's guilty plea for passing driving penalty points to his wife, and a week of negative headlines about Clegg's handling of sexual harassment allegations against former chief executive Lord Rennard.
Addressing cheering supporters at Hampshire Cricket Club's Ageas Bowl ground, Clegg said: "This has been a by-election we've had to fight in exceptionally difficult circumstances. Our opponents have thrown everything at us.
"We held our nerve, we stood our ground, we worked as a team, we went out and campaigned on every doorstep, we overcame the odds and won a stunning victory."
Clegg said that last night's result "emphatically" proved wrong the critics who claimed that as a result of his decision to go into coalition with Tories in 2010, the Lib Dems would "lose our soul, lose our values, lose our identity, lose our ability to win".
"For the Liberal Democrats, my view is the message is very simple: we can be a party of government and still win," said the Deputy Prime Minister
"My ambition has always been to lead our party from opposition into being a party of government, but not just that, into becoming a winning party of government.
"That's what we proved last night and we proved it because we showed the people of Eastleigh ... how we are delivering for them and their families, not just locally but nationally too."
Tory Maria Hutchings polled 10,559 votes - more than 1,000 behind Ukip, which snatched huge chunks of the coalition parties' 2010 general election vote share, taking more than 27% of the total.
Cameron insisted the result would not prompt him to steer the party further to the right.
Asked if the result was a crisis for the party, he said: "I don't think we should tack this way, tack that way.
"What we have got to do is deliver for people who work hard, who want to get on, and deliver on the agenda that they care about and I care about.
"That means getting our economy moving, it means continuing to reduce our deficit, it means continuing to cut immigration, it means continuing to reform welfare, it means delivering for people who work hard, who want to get on, who want to do the right thing for their families.
"That is my agenda, that is their agenda. This is a by-election, it's mid-term, it's a protest. That's what happens in by-elections.
"It's disappointing for the Conservative Party but we must remain true to our principles, true to our course, and that way we can win people back."
Ukip leader Nigel Farage described the Eastleigh result as a "massive boost" for his party ahead of English county council elections in May and next year's European Parliament polls - when he said Ukip would cause "an earthquake" in British politics.
"People will say it was a protest vote, but who we attracted here were non-voters who had not voted for 20 years - they are not protest votes," he said.
Farage, who had pondered standing himself, said he would not have done any better than James and joked: "If the Conservatives hadn't split our vote we'd have won, wouldn't we?"
Tories should blame their poor result not on Ukip - which also picked up votes from Labour and Lib Dems - but on their leader, he said.
"The Conservatives failed here because traditional Tory voters look at Cameron and they ask themselves 'Is he a Conservative?' and they conclude 'No, he's not'," Farage told the BBC Radio 4 Today programme.
Hutchings, whose 25.4% vote share was 14 points down on what she secured against Huhne in 2010, appeared to be fighting back tears as she thanked opponents for a "clean campaign" and left the count without speaking to the media.
Conservative Party chairman Grant Shapps tried to play down the significance of the shock result - which influential backbench MP David Davis had warned would mean a "crisis" for his party.
Shapps insisted you "can't read much into by-elections" - seeking to explain the poor showing in what had initially been billed as a two-way fight between the coalition partners as a classic mid-term voter revolt.
But the failure not only to overcome a Lib Dem party engulfed in the Huhne scandal and claims of sexual harassment by a senior party figure but also to outperform Ukip will reignite smouldering backbench dissent.
The Hampshire seat is one of a list of 20 Lib Dem-held constituencies Shapps has said are crucial for the party to win in 2015 if the Prime Minister is to secure an outright majority.
Lib Dem president Tim Farron said the result represented a "turning point in this parliament" that would "strengthen our hand very much within coalition in the run up to the budget".
And he suggested it left the Lib Dems in "a very strong position to start gaining seats from the Conservatives".
Farron, who declared that the party had "screwed up" its handling of the complaints against Lord Rennard, added: "Without a single doubt at all the party is united behind Nick Clegg. There is no crisis in his leadership."
Labour's candidate, satirist and author John O'Farrell, polled 4,088 votes, securing only a marginal 0.2% increase on the party's 2010 general election vote share.
It is a disappointing performance for Opposition leader Ed Miliband, who had hailed the by-election as a test for his "One Nation" message.
Miliband said: "Clearly I would have preferred to have got more votes than we did, but this was always going to be a tough fight for Labour - it's a seat that we've never won.
"It convinces me that we need to redouble our efforts to reach out to every part of the country, including areas where Labour hasn't traditionally been strong.
"This was a disastrous night for the Conservatives and David Cameron. What we want to hear from the Prime Minister is a recognition that people are deeply unhappy with the direction of the country and he's going to listen."