New White House communications chief Anthony Scaramucci has deleted tweets in which he shared contrasting views to US President Donald Trump saying they were a distraction.

Mr Scaramucci cleared up his Twitter trail of remarks in which he differs from Trump on illegal immigration, climate change, Islam and even gun control.

Mr Scaramucci said on twitter: "Full transparency: I'm deleting old tweets. Past views evolved & shouldn't be a distraction. I serve @POTUS agenda & that's all that matters."

He then added, "The politics of 'gotcha' are over. I have thick skin and we're moving on to @POTUS agenda serving the American people."

In a 2012 tweet, he appeared to back many causes long championed by Democrats, describing himself as "for gay marriage and against the death penalty".

Following Mr Scaramucci’s appointment, White House press secretary Sean Spicer abruptly resigned.

In a written statement, Mr Trump said he was "grateful" for Mr Spicer's work and praised his "great television ratings," a reference to Spicer's keenly watched, combative and often-satirized news briefings.