Azarov said he had taken a "personal decision" to resign to keep Ukraine together as a state, as parliament met in an emergency session to vote on reforms and amendments backed by President Viktor Yanukovych.
Parliament overwhelmingly voted to scrap anti-protest laws that sparked the current crisis when the ruling party pushed them through the Verkhovna Rada in a shambolic show-of-hands vote on January 16.
The dramatic twists in Ukraine's two months of turmoil came as Russian President Vladimir Putin met with EU chiefs at a summit in Brussels expected to be dominated by the turmoil.
In a morning announcement that took the opposition by surprise, Azarov yielded to months of pressure from the opposition who made his resignation a key demand of protests based in Independence Square in Kiev.
Also Read
Azarov said that he hoped his resignation would create "an additional possibility for a political compromise to peacefully resolve the conflict".
"Today the most important thing is to preserve the unity and integrity of Ukraine," he said.
The leader of the UDAR (Punch) party, world boxing champion Vitali Klitschko, said Azarov's move would only partially satisfy the opposition.
"This is not victory but a step to victory," said Klitschko.
The opposition still wants to oust Yanukovych from power, possibly through early elections which are currently due only in 2015.