As soon as one race for the White House ends, another begins – the sprint among British politicians to try to associate themselves with the winner. "Warm congratulations to my friend @BarackObama. Look forward to continuing to work together," tweeted David Cameron – or more likely the under-strapper manning the prime minister's account since the message was sent at 6.07am. Ed Miliband's team were caught snoozing under their duvets. It was not until 8.41am that a rival tweet went out in the name of the Labour leader: "Congratulations to @BarackObama – great victory based on building fairer economy and optimism about what politics can achieve."

Whether or not he can use his historic second term to heal America, Barack Obama did succeed in uniting David Cameron and Ed Miliband – and Nick Clegg for that matter too. All three wanted to see him returned to the Oval office and all three think his victory is encouraging for their own fortunes.

The most obvious reason for Tories to be celebrating is that he won re-election in adverse economic circumstances. Nick Clegg has also been drawing some comfort from the fact that President Obama did not join Nicolas Sarkozy, Silvio Berlusconi and the rest of the political casualties of the age of austerity to become the 18th leader hurled from office since the crash of 2008. The Lib Dem leader taunted Labour with the thought: "The lesson of the presidential election is that voters' memories are longer than opposition members seem to think. Voters remember who created the mess in the first place."

It has been frequently said that this is the first major victory for incumbency in the west since the credit crunch. That's not actually right, unless you don't count Australia, Canada and New Zealand as important countries.

Julia Gillard, who became Australia's Labor prime minister after deposing Kevin Rudd in a party coup, was returned to office in 2010, though it was a narrow squeak. In 2011, Stephen Harper, the Canadian Conservative, turned a minority government into a majority one. Also last year, John Key secured re-election for the conservative National party in New Zealand. So Barack Obama is not the only exception to the rule that incumbency is a liability in austerity. He is the most striking. As one of David Cameron's aides puts it: "Breaking the hoodoo of incumbents being chucked out is very significant."

They have one thing in common, this select group of leaders who have defied the anti-incumbency trend. They initially took power after a long period of rule by the other side. Labor came to office in Australia after 11 years of Liberal government. The Canadian Conservatives had been in opposition for 13 years. Labour-led governments had ruled New Zealand for nine years before Mr Key. Mr Obama became president after eight years of Republican control of the White House. This made it more plausible for them to assign blame for economic travails on their inheritance from the other lot. "Obama told the American people it's not our mess, but we're doing our best to fix it," says one Conservative strategist. "It doesn't take a brain surgeon or a rocket scientist to work out that this will be a core Conservative message at the next election here.'

Labour retorts that, in contrast to the austerity economics of the coalition, President Obama pursued a policy of stimulating growth, avoided a double dip recession and, in the final stretches of the campaign, could point to a positive turn in some key indicators to argue that the worst was behind America. No one can say with confidence whether that will be the case in Britain in 2015. Even if there is a return to growth, some Tories worry that it will be a voteless recovery if it does not translate into an improvement in living standards. President Obama's victory shows it is possible for incumbents to be re-elected in tough times. It in no way guarantees that we will get the same result here in two and a half years' time.

All the British parties will try to learn from other dimensions of this American election, especially the use of data mining to maximise votes, the exploitation of social media and the superb organisation of the Obama campaign which proved very effective at mobilising his supporters to the polls. But the biggest lesson from this American campaign is not a new one at all; it is a very, very old one. Elections are won by getting more people to support your guy than the other guy. Put like that, it sounds so obvious as to be stupid. I put it that way, nevertheless, because it is remarkable how often political parties neglect or even wilfully defy this basic rule of winning power.

The Republicans in America forgot it and they duly lost. Some have contended that it was the Hispanic vote, which went to Mr Obama by such a large margin, that denied the presidency to Mitt Romney. You could equally well argue that it was the African American vote or the female vote or the young vote or the urban vote or the moderate vote or the independent vote. The Republicans did not make themselves attractive to key sections of the American electorate – indeed they often went out of their way to be offensive to them – on the fatalistic assumption that they were not going to vote Republican anyway and on the deluded basis that the election could be won without them. It couldn't. As one Republican wittily put it, his party "ran out of angry white men". In states in which they were once dominant, California with its mighty 55 electoral college votes being a prime example, the Republicans were not even competitive.

The Tory predicament here is not quite the same, but there are transatlantic similarities which aren't encouraging for the Conservatives. Like the Republicans, the Tories have a problem appealing to women and ethnic minorities. Like the Republicans, the Tories are uncompetitive in a lot of the country, a problem for them which gets more severe the further north you travel. Like the Republicans, the party's leadership has to contend with a shrill, zealously ideological faction which seems to think it is enough to get the votes of "angry white men".

The Conservatives' Tea party tendency have become more and more noisy in urging Mr Cameron to shift rightwards – perhaps I should say further rightwards – by being even more aggressive in cutting public spending, even more belligerent towards the European Union, even fiercer on issues such as immigration and crime. At the same time, they have clamoured for him to ditch what remains of his original modernisation of the Tory party by abandoning the commitment to gay marriage, scrapping the pledge on international aid and giving up entirely on any pretension to be interested in tackling climate change. Had Mitt Romney won, we know what the Tory right would be saying this weekend; they would be hailing it as confirmation of their view and pressing even harder on the prime minister to move in their direction. For them, this is a major reverse- or should be. While it is not always wise to make a direct read-across, it is fair to observe that if America rejects this form of politics, it is even less likely to succeed in Britain.

"The Tea party candidates got caned," gleefully notes one centrist Tory, who hopes that what happened in America will strengthen his wing of the party against the right. Mr Cameron was quick to try to impress this lesson on his colleagues, saying that President Obama's victory demonstrated that "elections are won in the common ground, the centre ground... That is the message loud and clear from this election... You win elections in the mainstream." Whether his party is really capable of absorbing this message is moot.

Labour people say they didn't need a tutorial from America to understand that you don't win elections by narrowing your appeal. "We knew that already," says one shadow minister. They have been a bit ridiculously excited that President Obama used the phrase "one nation" in his soaring, bipartisan victory speech, though I find it unlikely that the American president studied Ed Miliband's party conference speech for inspiration.

Labour's team have noted the ruthlessness with which the Obama campaign defined his opponent as a vulture capitalist, negative framing from which Mitt Romney never escaped. They are already trying to do something similar to the Conservatives by depicting them as people who govern only in the interests of people as rich as themselves. In the Labour argument, Obama won because he was "on the side of the 99%" rather than a friend of millionaires.

A less crude way of putting this is that Mr Obama prevailed because he persuaded more voters that he was on their side. Ed Miliband cannot yet claim the same. His "one nation Labour" is more of a concept than a practicality at the moment. There is still a lot of work to do if Labour is to reassemble a coalition of support wide enough to make it a majority government.

The essential lesson from America is the same for all the parties and it is the more potent because it comes from a country in which politics is so polarised. Austerity may have changed many things, but it has not changed the basic law. Elections are still won and lost in the centre.