Bartz, 63, said she got the news during a phone call from Yahoo Chairman Roy Bostock.
The development came as no surprise to many observers.
In June, stockholders slammed the company for its slumping stock price and its loss of display ad market share to rivals Google and Facebook.
Yahoo has now replaced three CEOs in a little over four years.
Known for her no-nonsense leadership and sometimes gruff language, Bartz arrived at Yahoo as a respected Silicon Valley executive who had won praise for turning around business software maker Autodesk Inc. But she had no previous experience in Internet advertising, the main way Yahoo makes money.
Yahoo, based in Sunnyvale, Calif., plans to search for a permanent replacement. In the meantime, Timothy Morse, the chief financial officer, will take the helm.
The Associated Press contributed to this report.