Donald Trump's new communications chief has deleted tweets in which he shared views contrary to the US president's own, saying they were a distraction.

The day after he started his new job Friday, Anthony Scaramucci, a New York financier, cleared up his Twitter trail of remarks in which he differs from Trump on illegal immigration, climate change, Islam and even gun control.

"Full transparency: I'm deleting old tweets. Past views evolved & shouldn't be a distraction. I serve @POTUS agenda & that's all that matters," the new man on the White House job announced on Twitter.

A bit later, Scaramucci followed up with "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 comment he tweeted, he appeared to back many causes long championed by Democrats, describing himself as "for Gay Marriage, against the death penalty, and Pro Choice."

White House press secretary Sean Spicer abruptly resigned Friday in protest at Scaramucci's hiring.

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

Spicer's departure marked rising tensions in an administration that has seen its legislative agenda falter at the same time it has been buffeted by an investigation into alleged collusion with Russia.