The White House mistakenly referred to the Chinese leader Xi Jinping as the president of Taiwan just hours after Donald Trump spoke of his “wonderful relationship” with Mr Xi.

The US leader spent 90 minutes discussing trade and the nuclear threat from North Korea with Mr Xi at the G20 summit in Hamburg, Germany.

He struck a friendly chord with the Communist Party chief, telling him it was “an honour to have you as a friend” ahead of the highly anticipated meeting.

But an official transcript of the occasion, released by the White House, referred to Mr Xi as president of “The Republic of China”, which is the official name for Taiwan.

The mix-up was ridiculed by China experts, who pointed out that Taiwan’s leader Tsai Ing-wen is a democratically elected woman, and is considered a political rival of Mr Xi.

Patrick Chovanec, a former professor at Tsinghua University in Beijing, was reminded of former President George Bush’s gaffes.

“I remember when Bush Admin announced the anthem wrong, but this is pretty bad,” he tweeted.

The academic was referring to a diplomatic gaffe in 2007 when Mr Bush’s team played Taiwan’s national anthem as a Chinese ambassador attended the opening ceremony of a China-financed stadium on the island of Grenada in the Caribbean.

Ivanka Trump plays significant role standing in for Donald Trump at G20

Chris Lu, who worked in former president Barack Obama’s White House team, tweeted: “Ouch. White House just referred to Xi Jinping as leader of Republic of China, which is Taiwan. #AmateurHour.”

Press Secretary Sean Spicer’s office released the official transcript, which quoted President Trump talking about China as a “great trading partner”.

It is unclear how the gaffe could affect relations between the pair which have been strained at times since Mr Trump took office.

Shortly after his presidential inauguration, the US leader looked to have sparked a potentially damaging diplomatic row with China after speaking to Taiwanese president Tsai Ing-wen.

China claims Taiwan as its own territory and complained after Mr Trump upset decades of diplomatic precedent.

Donald Trump and Sean Spicer kiss on SNL

In December, the president said in an interview that he didn't feel "bound" by the decades-old one China policy unless the US could gain concessions from China in trade and other areas.

Washington has robust unofficial relations with the island and provides it with arms to guard against Beijing's threat to use force to reunify with it.