File photo of Donald Trump with Boris Johnson at UN Headquarters in New York. (Reuters)

US President Donald Trump on Tuesday heralded the selection of Boris Johnson as the new leader of Britain's governing Conservative Party and the United Kingdom's next prime minister, in a possible sign of warmer relations between the two allies.

"Congratulations to Boris Johnson on becoming the new Prime Minister of the United Kingdom. He will be great!" Trump said in a post on Twitter shortly after Johnson's election.

Trump has had tense relations with outgoing British Prime Minister Theresa May despite being hosted for a state visit. Ties were further strained this month following leaked messages by the British ambassador to Washington that referred to Trump; the official later quit.

The US president has repeatedly praised Johnson, the flamboyant former London mayor and pro-Brexit champion who has been compared to the Republican US president, a former reality television host and real estate developer known for his unconventional, combative approach to politics.

Johnson was the overwhelming favorite to win Tuesday's Conservative Party election despite a chaotic private life and a reputation for lies, exaggeration, a lack of seriousness and discipline. He replaces May, who stepped down after failing to deliver on her Brexit plan to leave the European Union.

Like Trump, Johnson has led a country-first campaign and will now lead a heavily divided nation.