Nick Clegg was today named as the new leader of the Liberal Democrats, beating rival Chris Huhne by just 511 votes.
The contest was so close party officials are understood to have held a recount. The final result was 20,988 to 20,477.
In a speech following the declaration, Clegg said: "My election as leader today marks a new beginning. Today is about two things: ambition and change.
"Renewed ambition for the Lib Dems, renewed ambition to reach out to the millions of people who I know share our instincts and values but do not yet vote for us.
"It is about renewed ambition for Britain."
Declaring the winner, Vincent Cable, the party's acting leader said that the two candidates had both proved they would continue in the tradition set by previous leaders to "challenge established wisdom and consensus".
Speaking in the presence of four former party leaders, Cable said: "It's clear that each of the candidates would have been admirably suited to taking the party to success."
Conceding defeat, Huhne congratulated Clegg and said: "I look forward to participating as part of Nick's team to make sure the party goes from strength to strength."
Clegg, the party's home affairs spokesman, led the field from the outset as Lib Dem activists rated him as the candidate with the communication skills and telegenic public appeal to restore the party's fortunes.
At 40, Clegg's youthful image signals a departure from his older and more statesmanlike predecessor, Sir Menzies Campbell.
Ed Davey, the party's chair of campaigns and communications and the leader's chief of staff, said the new leadership was an opportunity for new ideas to engage the wider electorate.
He said: "We want to reach out to people who have not considered voting for us before and I think Nick has those ideas and the ability to communicate them effectively."
Campbell resigned two months ago, after just 19 months in the post, amid concern over slumping poll ratings. The 66-year-old had complained of constant jibes about his age.
Campbell had beaten Huhne to the top job in January last year when Charles Kennedy was ousted after admitting a drink problem.
His deputy, 64-year-old Cable, ruled himself out of the running from the start of this contest because of what he called "irrational prejudice" against age.
The votes were counted after a postal ballot of the party's 65,000 members closed on Saturday. A total of 41,465 votes were cast.
This followed a series of head-to-head hustings across the country, with Clegg winning the declared backing of 38 of his 62 Commons colleagues and enjoying a healthy 12-point lead in one recent opinion poll.
But his older rival, who highlighted his experience outside politics - as a journalist and economist - had hoped to secure the support of thousands of members who waited until the last minute to vote.
Cable, whose performance as acting leader has fuelled a surge of popularity for his own leadership credentials, had believed the race too close to call.
Clegg's win comes days after senior party figures laughed off an offer by the Tory leader, David Cameron, to forge a "progressive alliance" with the new Lib Dem leader against Gordon Brown.
Cable, who has appeared to suggest he believes he will retain his role as deputy leader and Treasury spokesman, said that Cameron was living in "cloud cuckoo land".
But the members will now hope Clegg can turn around the party's fortunes, which slumped to a critical low of 11% in October as Brown's "bounce" gave way to Cameron's surge in the polls and both parties took votes from the third party.
Cable has managed to reverse the trend to some degree, with one survey last weekend putting the party up one point on 14%.
By voting for Clegg, the Lib Dems have continued their embrace of a more free-market approach to policy, as characterised by the seminal Orange Book, published three years ago and worked on by both Clegg and Huhne.
But the vote for Clegg may be seen as representing party confidence in his image rather than his policies, which differed little from those of Huhne, the party's environment spokesman.
Throughout 60 media events and hustings, both proclaimed similar goals with slightly different ideas for achieving them.
Huhne's "liberal revolution" aimed to revive the "anti-establishment edge" of the party and create a fairer society.
Clegg wanted to reach "beyond party politics" to connect with the millions of liberal voters who support other parties.
Both wanted to focus on improving the educational prospects of the most disadvantaged children, Clegg by using his idea of a "premium" for the worst-off, Huhne through increased state-pupil spending and intensive tuition for children struggling to read.
Both wanted to localise healthcare decisions and, as both are former MEPs, they backed embracing the European Union but seeking to reform and decentralise it.
On climate change, Clegg wants to draw up a "covenant" between government, business and citizens to tackle global warming.
He will oppose the government's ID cards scheme, and as home affairs spokesman has also spoken out on immigration, saying there should be a more managed process with clearer rights of appeal.
Huhne, desperate to distinguish himself throughout his leadership campaign, sought to highlight clearer policy differences between himself and Clegg.
In the most notable episode of the contest, one of his aides termed his opponent "Calamity Clegg" in a briefing document, accusing him of flip-flopping on policies.
Huhne apologised for the document, and said he had no knowledge of it, but he went on to berate Clegg on BBC1's Politics Show.
He said that Clegg had not established clear policies on nuclear weapons, schools and the health service.
But Clegg told Huhne he was trying to create "synthetic differences" which "our opponents will use against us".
He said: "I have said to you until I'm blue in the face that my position is very clear on all the issues ... where what you are seeking to do is believe the worst that is said about me."
Nick Clegg has came out first in the race to become the new leader of the Liberal Democrat Party, the third largest party in the United Kingdom.

Clegg congratulated Vincent Cable on his performance as acting leader of the Liberal Democrats, which he took after the resignation of Menzies Camp

He beat Chris Huhne in the party's election, although the number of votes was very close - Nick Clegg had just 511 more votes than Huhne.

During his acceptance speech he said "I want the Liberal Democrats to be the future of politics," and that he hoped his leadership of the Liberal Democrats would be about ambition and change. He also acknowledged that it was a close contest. His acceptance speech took place in a central London hotel. 

In his speech he also criticized the Labour and Conservative parties by saying they were mutating in to one party and encouraged unsatisfied voters to vote for the Liberal Democrats.