In a statement issued by Downing Street, Mrs May said: “I would like to congratulate Donald Trump on being elected the next President of the United States, following a hard-fought campaign.
“Britain and the United States have an enduring and special relationship based on the values of freedom, democracy and enterprise.
“We are, and will remain, strong and close partners on trade, security and defence. I look forward to working with President-elect Donald Trump, building on these ties to ensure the security and prosperity of our nations in the years ahead.”
Although Mrs May has refrained from criticising Mr Trump since she became prime minister and Downing Street wished “good luck” to both candidates, the new UK-US relationship begins on the shakiest of foundations.
Nigel Farage, the Ukip leader, is the only senior British politician to back Mr Trump, and acted as an adviser to the property tycoon during the campaign to help him “do a Brexit” and overturn the political establishment.
Nicola Sturgeon, Scotland’s first minister, said: “While this is not the outcome I hoped for, it is the verdict of the American people and we must respect it. I congratulate president-elect Trump on winning the election.”
Jeremy Corbyn, the Labour leader, said many people would be “understandably shocked by Donald Trump’s victory in the US presidential election, the rhetoric around it and what the election result means for the rest of the world, as well as America”.
Mr Trump’s election, he added, was an “unmistakable rejection of a political establishment and an economic system that simply isn’t working for most people”. However, some of the president-elect’s answers “to the big questions facing America … are clearly wrong”.
While Mr Trump is seen as toxic by MPs across the political divide at Westminster, British prime ministers are obliged by history and for strategic reasons to work closely with whoever occupies the White House.
The president-elect’s promise to seriously consider a UK-US trade deal — in place of the stalled EU-US transatlantic agreement — would be a serious prize for Mrs May, even though such a deal would be several years away.
Mr Trump said during the campaign: “Britain’s been a great ally. They’ve been such a great ally they’ve gone into things they shouldn’t have gone into, for example going into Iraq. With me, they’ll always be treated fantastically.”
Referring to President Obama’s claim that Britain would be “at the back of the queue” for a trade deal, Mr Trump said: “I’m not going to say front of the queue but it wouldn’t make any difference to me whether they were in the EU or not. You would certainly not be back of the queue, that I can tell you.”
Mr Farage has argued that Mr Trump is “a friend of the UK”, with family ties to Scotland and a big economic stake in his golf resorts north of the border. Mr Trump’s mother emigrated to the US from the Isle of Lewis in the Outer Hebrides.
Lord Renwick, a former British ambassador to the US, told the BBC’s Todayprogramme the transatlantic relationship was “not based on sentiment but common interest” and said both sides were committed to fighting Isis.
“The one opportunity is for a free-trade deal with America, which the Trump team says he will support,” the former diplomat said. “I would expect him to make an attempt to establish a good working relationship with [Mrs May].”
Mr Trump’s comments during the election about Muslims and claims that extremists had made parts of London “no go zones” brought calls from MPs that he be banned from Britain, in spite of his status as a leading investor in Scotland’s golf courses.
The candidate’s claim that some places in London were “so radicalised that police are afraid for their lives” brought a withering response from Boris Johnson, foreign secretary, and the man now charged with smoothing relations with the US.
“The only reason I wouldn’t go to some parts of New York is the real risk of meeting Donald Trump,” Mr Johnson, the former London mayor, said.
Mr Trump’s approach to Nato and the alliance’s defence of central and eastern European states against Russian threats will be at the top of Mrs May’s agenda: Britain is the biggest Nato contributor in Europe.
In January Mr Trump was variously described as “racist and misogynistic”, a “wazzock” and a “buffoon” at Westminster, as MPs debated whether to ban a prospective US president from Britain.
But many MPs concluded that banning the candidate would be counterproductive and David Cameron, former prime minister, and the Labour leader Jeremy Corbyn argued it ran against the British tradition of free speech. That came as a disappointment to the 573,000 people who signed an online petition demanding a ban; this, in turn, triggered a Westminster debate which attracted heavy media coverage in the US.
The president-elect did travel to Scotland on the day after the Brexit referendum in June, declaring on a visit to the Trump Turnberry golf course that the vote to leave the EU was a “great thing” and that the people of the UK had “taken back their country”.