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 Reuters news agency reports.
The surprise announcement halted an impeachment hearing that had begun against him.
Lawmakers roared in jubilation and people have begun 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.