He held power for 37 years and once said "only God" could remove him.
While still considered by some to be an African independence hero, his many critics see him as a despot who ruled by fear and brought a once-promising economy to near ruin.
His shock resignation came in the form of a letter read out by the speaker of parliament.
In it, Mr Mugabe - who had so far resisted pressure from the public, the army and his own party to step aside - said he was resigning to allow a smooth and peaceful transfer of power, and that his decision was voluntary.
The announcement abruptly halted an impeachment hearing that had begun against him on Tuesday.
Lawmakers from the ruling party and opposition roared with glee, and spontaneous scenes of joy erupted in the streets with people dancing, singing, honking car horns and waving flags.