The 45 year old also said he had told Mr Trump he “would stay on for a few weeks to achieve a smooth transition”, and was looking forward to spending more time with his family.

President Trump tweeted: “Sean Spicer is a wonderful person who took tremendous abuse from the Fake News Media – but his future is bright!”

The New York Times reported that Mr Spicer had “vehemently” disagreed with the appointment of Mr Scaramucci, which he believed to be a “major mistake”.

Spicer’s low points

Media captionThey were the largest crowds. Period.

inflating crowd size estimates at Trump inauguration at first briefing

his appearance, particularly his suits, reportedly criticised by Trump

saying Hitler never used chemical weapons and referring to Holocaust “centres”

butt of text message joke by adviser Steve Bannon about his weight

defending Trump “covfefe” tweet by saying it had hidden meaning

frozen out of meeting with the Pope in Rome, despite being devout Catholic

not invited to Paris for Trump visit

Mr Spicer’s often chaotic press briefings over the past six months were a cable news hit, but in recent weeks he had withdrawn from appearances in front of the camera.

What does Scaramucci say?

In an assured debut, he attended Friday afternoon’s news conference to announce that Sarah Huckabee Sanders, formerly Mr Spicer’s deputy, would step into his shoes.

“I love the president and it’s an honour to be here,” Mr Scaramucci said, adding: “He is genuinely a wonderful human being.”

Mr Scaramucci, who has no previous experience in communications roles, paid tribute to Mr Spicer as “a true American patriot” and “incredibly gracious”.

“I hope he goes on to make a tremendous amount of money,” he added.

Media captionIt’s his first day, and he has to say sorry to the boss

Mr Scaramucci also apologised and said he had been “unexperienced” as he explained his previous criticism of the president.

In an August 2015 interview with Fox Business, he dismissed Mr Trump as a “hack” and “an inherited money dude” with “a big mouth”.

Mr Scaramucci is currently senior vice-president of the Export-Import Bank, a US government agency which guarantees loans for foreign buyers of American exports.

A former member of the Trump transition team, he mistakenly suggested to the BBC in January that Elton John would play at the new president’s inauguration. The singer promptly denied it.

Bigger tremors to come? Analysis by Anthony Zurcher, BBC News

Life on a White House staff is intense and exhausting.

This administration is under particular pressure, given the ongoing Russia investigation, recent legislative setbacks and a president who can be, shall we say, occasionally off-message. Now cracks in the structure are beginning to show.

Sean Spicer’s departure, reportedly because he doesn’t want to work for newly named communication director Anthony Scaramucci, represents the most significant shakeup within the administration’s senior team to date. It could also be a sign of bigger tremors to come.

Mr Spicer was closely allied with White House chief of staff Reince Priebus, who was his boss last year in the Republican National Committee.

The Trump team has been rife with personal feuds, as various factions vie for a mercurial president’s ear. Leaks abound.

The prestige and power of advisers and aides wax and wane. Media reports abound of a White House under siege.

And just a reminder – the Trump presidency is only six months old.

On day one in January, Mr Spicer set the tone of his relationship with the press by bursting into the briefing room to berate journalists for their reporting of crowd numbers at President Trump’s inauguration.

His proclivity for gaffes and garbling of his words, as well as making debatable assertions, soon made Mr Spicer a household name.

Image copyrightAFPImage captionSarah Huckabee Sanders was named on Friday as the new White House press secretary

But he could also be charming and was liked by many among the press corps.

Mr Spicer was lampooned on topical comedy show Saturday Night Live, where Melissa McCarthy played him as a loud-mouthed bully who brandished his lectern at reporters.

Mr Trump noted approvingly in April that Mr Spicer “gets great ratings”. A month later, the president said: “He’s doing a good job but he gets beat up.”

Mr Spicer was roundly mocked after he reportedly hid by a hedgerow on the White House grounds to avoid reporters on the night Mr Trump fired the FBI director in May.

His last on-camera briefing was on 20 June, and there have been few since then.

Members of the media have accused the Trump administration of attempting to kill off the daily news conferences to avoid scrutiny.