David Cameron is to use Mitt Romney's failure in the US presidential election to warn the Tory right that the Conservative party will consign itself to the margins unless it remains resolutely on Britain's "common ground".

Hours after learning of Barack Obama's re-election during the final day of his tour to the Gulf and the Middle East, the prime minister said a "loud and clear" message had emerged from the US election.

Cameron also moved to scotch Labour euphoria at the success of its US sister party by saying that Obama's success with the Democrats showed governments can win by adopting a "right track, hard road" approach on the economy.

The prime minister breathed a sigh of relief after learning of Obama's success because the two leaders have built up a strong rapport over the last two years. Obama admired the prime minister for taking decisive action in Libya and he rewarded him with a reception on the South Lawn of the White House in March, which was a state visit in all but name.

Cameron would have had a prickly start to relations with a President Romney after delivering a public rebuke to the Republican candidate after he questioned London's preparedness to stage the Olympics. A Romney victory would also have emboldened the Tory right, which Cameron refers to with disdain in private.

The prime minister went further than offering the usual congratulations to a newly re-elected US president as he expressed delight at the result. Cameron, who is expected to meet Obama within months ahead of Britain's presidency of the G8 next year, said: "In terms of working with Barack Obama I am delighted with the result and congratulate him," he said.

He made clear that the Tory right, which is putting pressure on him to campaign on more traditional Conservative themes, should take note of Obama's success. "I believe that elections are won in the common ground – the centre ground," Cameron said. "That is where you need to be, arguing about the things that matter to most people – that is making sure they can find a good job, they can build a good life for themselves, that if people work hard and try to get on you are behind them and helping them. That is the message loud and clear from this election as it is from all elections. You win elections in the mainstream."

The prime minister did not identify any Tories on the right. But Downing Street is taking note of the new Conservative Voice group launched with the enthusiastic support of Tim Montgomerie, the founder of the ConservativeHome website, who was an enthusiastic Romney supporter.

While Cameron and Obama hail from vastly contrasting backgrounds, they have provided each other with useful political support. To the fury of Romney, Cameron accepted an invitation from Obama during his US visit last March to travel on Air Force One to watch a basketball game in the vital swing state of Ohio. Cameron is acutely aware of the immense political value for a Tory leader to be seen on easy terms with the US's first African-American president.

Cameron even suggested that he and Obama, whose fiscal stimulus programme was hailed by Labour, are adopting a similar economic approach.

"I was very struck by the fact that Barack had been saying it's a hard road but we're on the right track," he said. "And a government that's worked hard to deliver economic recovery can be re-elected … I do think: right track, hard road but if you deliver on the economy you can win re-election I think is an important message."

The prime minister felt confident enough to note that Obama had used some Tory language, new and old. "I even noticed in his tweet he had: 'We're all in this together.' So there's commonality. One Nation [also mentioned by Obama] is a famous Conservative phrase first invented by Disraeli."

Cameron qualified his remarks about the lessons for Britain by saying that the US and UK centre right occupy different parts of the political terrain. No 10 regularly jokes that the prime minister would be regarded as a socialist by many US Republicans after he declared that the NHS is his main priority.

"I think the thing about centre right parties is that we are different all over the world because centre right parties draw a huge amount from culture and history and the different conditions in different countries," he said.

"So there is no tradition on the centre right of arguments in this country about gun control. The Conservatives have always been able to work with American presidents of both parties and have good relations with both parties. So I think there are limited lessons to learn."