The Conservatives have achieved their first by-election gain in 26 years, taking Crewe and Nantwich from Labour.
Tory candidate Edward Timpson won 7,860 more votes than his Labour rival, overturning a 7,000 Labour majority at the general election - a 17.6% swing.
David Cameron said it was a "remarkable victory", was the "end of New Labour" and the start of "something bigger".
Labour leader Gordon Brown said the clear message was that voters wanted him to address economic worries.
He said people were concerned about rising food and fuel prices and the task "that I have" was to steer the UK through "difficult economic times".
Speaking outside his home on Friday, Mr Cameron said: "The Conservatives won a remarkable victory last night in Crewe and Nantwich and I want to congratulate Edward Timpson and everyone who took part in his campaign.
"But I know that winning a by-election and winning a general election are two different things and we've still got a huge amount of work to do."
The by-election comes weeks after Labour's poorest local election results in 40 years.
Mr Timpson, a 34-year-old barrister, took 20,539 votes. The Labour candidate, Mrs Dunwoody's daughter Tamsin Dunwoody, was second on 12,679, with Liberal Democrat Elizabeth Shenton third on 6,040.
Turnout was 58.2%, high for a by-election, but was down slightly from 60% at the 2005 general election.
Bad to worse
Labour's deputy leader Harriet Harman told the BBC: "It was a bad result for Labour last night. But I think we have to understand what lies behind it and what lies behind it is people's sense of their own prospects and the fact people are feeling the pinch."
She said people wanted "their immediate concerns addressed, that food's going up, fuel prices are going up and they want the government to very strongly focus on what we can do to back them up".
Edward Timpson's victory speech
She said the result had not been "a judgement from voters about our campaign" - shadow chancellor George Osborne accused them of resorting to "personal class war attacks" and "dog whistle" politics on immigration.
Ms Harman told BBC Radio 4's Today programme she knew there were "discordant voices" among some Labour MPs - but added: "The overwhelming majority of people in the Labour Party - and I speak to constituency chairs up and down the country ... they are fully behind Gordon Brown."
The campaign has taken place during a difficult few weeks for the prime minister, who has followed a poor set of local election results with the row over the abolition of the 10p tax rate.
Mr Cameron is expected to capitalise on the victory by calling an early by-election in Henley, the Westminster seat due to be vacated by new London Mayor Boris Johnson.
The Tories hope to build on their momentum, with 26 June or 3 July being talked of as the likely dates for a contest.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.