According to people with knowledge of the decision, Spicer is quitting because of objections over the appointment of a new White House communications director, New York financier Anthony Scaramucci.
Those with knowledge of the decision insisted on anonymity because they were not authorized to discuss the personnel matter publicly.
President Donald Trump did not ask for Spicer's resignation, senior White House sources told ABC News.
"It's been an honor & a privilege to serve @POTUS @realDonaldTrump & this amazing country," said Spicer said on Twitter. "I will continue my service through August."
Spicer has spent much less time in the briefing room in recent weeks, with principal deputy press secretary Sarah Huckabee Sanders handling more of the daily briefings.
He did brief the press off camera on Monday, and that was his first time doing so in three weeks.
At a White House press briefing Friday morning, Sanders read a statement from Trump: "I am grateful for Sean's work on behalf of my administration and the American people. I wish him continued success as he moves on to pursue new opportunities -- just look at his great television ratings."
Sanders then introduced Scaramucci, who in turn announced that she will replace Spicer as the next White House press secretary.
Spicer, 45, worked as the communications director for the Republican National Committee before being named as Trump's press secretary during the transition.
Spicer's tenure got off to a somewhat rocky start when, on Trump's first full day in office, the press secretary angrily chastised journalists over the crowd size at the presidential inauguration. Spicer then stormed out of the briefing room without answering questions.
A turbulent six months ensued. In April, Spicer was widely criticized after he stated: "We didn't use chemical weapons in World War II. You had someone as despicable as Hitler who didn't even sink to the level of using chemical weapons."
Spicer formally apologized the following day. His fiery demeanor and on-camera exchanges with reporters were lampooned on "Saturday Night Live," where he was portrayed by comedian Melissa McCarthy.
ABC News and the Associated Press contributed to this report.