WASHINGTON — White House press secretary Sean Spicer abruptly quit Friday after President Donald Trump named as communications director New York financier Anthony Scaramucci, who immediately took aim at “media bias” against the president.

Spicer confirmed in a tweet that he had resigned. At a White House news briefing, Scaramucci said Spicer decided to leave at the end of August to “clear the slate” for him as he took over what he promised would be an aggressive communications shop.

White House spokeswoman Sarah Huckabee Sanders, who has been filling in for Spicer at briefings, will replace Spicer as press secretary, Scaramucci announced in his introductory meeting with the White House press corps.

Trump praised the Long Island-born Scaramucci and charged him with improving a communications team led by Spicer, besieged and parodied during his six months as press secretary, one of the shortest runs in the job.

“We have accomplished so much, and we are being given credit for so little,” Trump said in a statement read by Sanders.

Scaramucci, a Goldman Sachs alum and Harvard Law School graduate, acknowledged he has no formal communications experience.

advertisement | advertise on newsday

But he said he had hosted “Wall Street Week” and appeared on news shows, where he vigorously defended Trump. And he pointed out that when CNN last month retracted a story about him and apologized that “I accepted the apology immediately.”

Scaramucci highlighted a “disconnect” between how the administration sees itself as a success and how the news media reports it. “There feels like there’s a little bit of media bias,” Scaramucci said. “And so, what we hope we can do is de-escalate that and turn that around.”

Scaramucci will replace Mike Dubke, who resigned in May.

He joins the administration as investigations by a special counsel and Congress into Trump and his possible campaign ties to Russian election meddling escalate, and as Republicans struggle to move a legislative agenda.

Scaramucci played down news reports that Spicer angrily quit after objecting to his hiring or that White House chief of staff Reince Priebus had blocked him from previous appointments.

Scaramucci called Priebus “a dear friend,” and said in 2012 he offered him the job of chief operating officer at his SkyBridge Capital firm, an offer Priebus declined.

“We’re a little bit like brothers,” Scaramucci said. “We rough each other up a bit, and that’s totally normal for brothers.”

Scaramucci put his loyalty to Trump on display in the briefing room as he sidestepped questions on the Russia-related investigations and whether he would televise all briefings again.

“I don’t think I would be standing here if I didn’t have a good relationship with the president. I love the president,” he said.

He defended Trump’s frequent use of Twitter, but deflected questions about how he would react if he put out a careful statement in the evening only to see Trump contradict in a tweet the next day — something that has often happened.

advertisement | advertise on newsday

“I do believe that that the best messenger or the best media person, the most savvy person in the White House, is the president of the United States,” he said.

Trump, who is close to Scaramucci, had considered him for other White House posts, including as liaison to the business community. But Scaramucci’s finances became tangled when he sold his company to a Chinese conglomerate with ties to the government.

“I have worked with the Office of Governmental (sic) Ethics to take care of all of my business conflicts,” he said. “My start date is going to be in a couple of weeks, so that it’s . . . 100 percent totally cleansed and clean.”