Mr Cameron said it had been a "remarkable victory" but said: "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."
He said that it was "encouraging" that "thousands of people who have never voted Conservative before have come across and put their trust in the Conservative Party" and said the party would not let them down.
He criticised Labour's "negative.. xenophobic" and "class war" campaign and said it had backfired.
"I think what happened was that, for Labour, it was the end of being of being the party of aspiration, it was the end of being the party of opportunity, it was the end of New Labour, here on the streets of Crewe and Nantwich."
'On the rise'
He said he wanted an end to "big, top-down, bossy, interfering government" and people wanted "something different".
He pledged to build a "coalition for change in our country so we really can remove this government and give Britain a better chance".
The self-proclaimed "heir to Blair" is trying to use the Crewe and Nantwich result to declare New Labour dead and at the same time he is trying to claim leadership of the Blair coalition for himself
During the by-election campaign Ms Dunwoody had criticised Mr Timpson's "Tory toff" background, but in the wake of defeat she said it was "robust but fun".
The Liberal Democrat candidate Ms Shenton said the government had been "very wrong" to "support a budget that taxed people on ordinary incomes more than the rich". And Lib Dem home affairs spokesman Chris Huhne said they had done well to get as large a share they did, saying that normally in by-elections the third party gets squeezed down to 3% or less.
He told the BBC's Daily Politics the result had been an anti-Labour vote rather than a pro-Tory one.
The Conservative Party's last by-election gain was in Mitcham and Morden, south-west London, in 1982.
A survey for BBC 2's Daily Politics programme suggested that twice as many people think David Cameron would make a good prime minister, than Gordon Brown.
Of those surveyed, 46% thought Mr Cameron would be the best prime minister, 23% backed Mr Brown and 7% backed Liberal Democrat leader Nick Clegg.
ComRes carried out the survey of 1,006 adults between 21 and 22 May.
The full results from the Crewe and Nantwich by-election were:
Edward Timpson (Con) 20,539 (49.49%, 16.93% increase on 2005 share of vote)
Tamsin Dunwoody (Lab) 12,679 (30.55%, -18.29%)
Elizabeth Shenton (Lib Dem) 6,040 (14.55%, -4.03%)
Mike Nattrass (UKIP) 922 (2.22%)
Robert Smith (Green) 359 (0.87%)
David Roberts (Eng Dem) 275 (0.66%)
The Flying Brick (Monster Raving Loony) 236 (0.57%)
Mark Walklate (Ind) 217 (0.52%)
Paul Thorogood (Cut Tax on Diesel and Petrol) 118 (0.28%)
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.