Barack Obama's record fundraising was the keystone of his success
Two years ago, Barack Obama was barely a blip on America's political radar.
But, with a brilliant, disciplined campaign, a vast amount of money and a favourable political climate, the junior senator from Illinois has risen to the most powerful job in the world.
His campaign will be a template for those seeking to replace him.
It was, even Republican strategists admit, a technically perfect ground campaign.
The money was key. Mr Obama realised during the primary contest that he had developed an extremely broad donor base, which he could keep going back to for money.
So, he rejected federal funding for his campaign and the financial limits that came with it.
Army of helpers
With the help of Facebook founder Chris Hughes - who devised an innovative internet fundraising system - the campaign eventually attracted more than three million donors. They donated about $650m (£403m) - more than both presidential contenders in 2004 combined.
Club-goers in Hollywood say healthcare issues won the vote
Mr Obama had the money for four times as many campaign offices as Mr McCain and a vast army of campaign staff and volunteers. They developed and exploited a vast database of information about potential donors and voters in every key state.
Everyone who visited the Obama website was asked to sign up to get more information. Everyone who did so was asked to contribute, or volunteer. If they did, they received several follow-up calls and messages asking for more money, or more assistance.
That fundraising ground campaign left him well equipped for the air war.
TV advertising is the life-blood of a campaign which has to span some 3.5m square miles (9m sq km) and 300 million people, and Mr Obama had no problem buying airtime.
In some swing states in the final weeks of the campaign, he was outspending Mr McCain by a ratio of four to one. His team again tapped into the internet, targeting ads at those online.
The campaign was masterful at getting out the vote
They even bought ad-space embedded in video games. Mr Obama could afford to campaign in Republican strongholds and force Mr McCain to spread his limited resources ever thinner, sucking his resources away from swing states.
At the same time the campaign was masterful at getting out the vote. It ran a huge registration drive for likely Democrats - adding more than 300,000 people to the voter rolls in Florida alone.
Realising that so many new voters could overwhelm polling places on voting day, the campaign made early voting a priority in states where it is allowed. More people cast their votes before election day this year than ever before - more than 29 million in 30 states, according to preliminary data.
All of this worked of course because of Barack Obama's appeal as a candidate. He is a superb orator who can work a crowd in the Bill Clinton tradition.
His image was wholesome; a self-made family man with one house, one car - and one family. It was a contrast to John McCain who divorced the wife who waited for him through the Vietnam war, married an heiress and couldn't remember how many houses he had.
Mr Obama was able to connect more deeply with more diverse voting blocks. He struck a chord with younger voters, won over Hispanic and Jewish voters who had been Republicans in the past, and of course got out the black vote like no president before him.
Mr Obama's single, consistent message of change was appealing when almost nine out of 10 Americans believed their country was "on the wrong track".
He could easily position himself as the anti-Bush candidate in a way Mr McCain struggled to do. President Bush had lower approval ratings than the disgraced Richard Nixon, and Mr Obama's relentless campaign message was that John McCain had voted with him 90% of the time.
The polls suggested more people trusted Mr Obama to fix the economy and when the financial crisis struck he was best placed to take political advantage of it.
His persistent focus on how to help those most impoverished by eight years of George Bush's leadership seemed a better fit for the times; a sharp contrast to the kind of tax cuts which were now a central plank of the McCain campaign and would disproportionately benefit the wealthy.
Difference a strength
Ultimately, even Mr McCain's great political strength as a war hero with decades of foreign experience was eclipsed.
Mr McCain's greatest strength - his foreign experience - was whittled away
Mr Obama's selection of the veteran foreign policy expert, Senator Joe Biden, as his running mate helped close the experience gap.
He insisted too that judgement was more important than experience and over the course of the campaign the political consensus seemed to shift to his ideas.
Mr Obama called for a withdrawal timeline in Iraq, defending Afghanistan's borders by launching raids inside Pakistan when required and talking to America's enemies.
Slowly and quietly even the Bush Administration came to accept those ideas, while John McCain seemed ever more isolated as he continued to reject them.
Barack Obama said he didn't "look like other Presidents on the dollar bill".
Although that was a reference to his colour, he was different in so many ways to the established political aristocracy, that in a year when Americans were craving something new, his differences turned out to be his part of his strength.
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.