A letter from Mr Mugabe said that the decision was voluntary and that he had made it to allow a smooth transfer of power.
The surprise announcement halted an impeachment hearing that had begun against him. Lawmakers roared in jubilation and people began celebrating in the streets.
Mr Mugabe had previously refused to resign despite last week’s military takeover and days of protests.
He has been in power since independence in 1980. Mr Mugabe has won elections, but over the past 15 years these have been marred by violence against political opponents.
He has presided over a deepening economic crisis in Zimbabwe, where people are on average 15% poorer now than they were in 1980.
What triggered the moves to oust him was his dismissal of Emmerson Mnangagwa as vice-president two weeks ago.
That decision was seen by many as clearing the way for Mr Mugabe’s wife, Grace, to succeed her husband as leader. It riled the military leadership, who stepped in and put Mr Mugabe under house arrest.
The speaker of Zimbabwe’s parliament speaker Jacob Mudenda says a new leader will be announced by the end of Wednesday.