Jubilant Zimbabweans have celebrated late into the night after Robert Mugabe resigned as president.
He held power for 37 years and once said "only God" could remove him.
His ally turned rival, former Vice-President Emmerson Mnangagwa, is expected to return from neighbouring South Africa and could be appointed as the new president within hours.
Mr Mugabe's 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.
'I'm so happy'
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.
"I'm so happy, wonderful, feeling so much excited, this is the greatest moment for our country," Julian Mtukudzi told the AFP news agency.
"We have been having sleepless nights hoping and waiting and we are so happy. It's over and it's done."
Activist and political candidate Vimbaishe Musvaburi broke down in tears of joy speaking to the BBC.
"We are tired of this man, we are so glad he's gone. We don't want him anymore and yes, today, it's victory," she said.
Zimbabwe's next president
The ruling Zanu-PF party says former Vice-President Emmerson Mnangagwa will succeed Mr Mugabe.
Mr Mnangagwa's sacking earlier this month triggered a political crisis.
It had been seen by many as an attempt to clear the way for Grace Mugabe to succeed her husband as leader and riled the military leadership, who stepped in and put Mr Mugabe under house arrest.
Mr Mugabe, 93, was until his resignation the world's oldest leader.
According to the constitution his successor should be the current Vice-President, Phelekezela Mphoko, a supporter of Grace Mugabe.
But a ZANU-PF official Larry Mavhima told Reuters Mr Mnangagwa is to return home for 11:30 GMT, where he is later expected to be sworn-in.
A city sings
Fergal Keane, BBC Africa editor, Harare
Driving through Harare, the cheers and the blaring of car horns signalled the end of the Mugabe era.
The man who dominated Zimbabwe for so long has already begun to fade into history here. It is a city singing with the noise of joy.
Exactly a week after the military first moved against President Mugabe, I was standing in parliament as legislators debated the motion to impeach him.
Suddenly, there was cheering.
An usher approached the speaker and handed him a letter. He stood to speak and we strained to hear his words. They were muffled but momentous. Robert Mugabe had resigned.
On the floor of the parliament I met jubilant MPs. Some danced. Celebrations spilled into the hallways and out into the street.
Notes of caution
Despite welcoming the news, Zimbabwean opposition and civil society figures have warned that the political culture needs to change.
Opposition leader Morgan Tsvangirai told the BBC he hoped that Zimbabwe was on a "new trajectory" that would include free and fair elections.
He said Mr Mugabe should be allowed to "go and rest for his last days".
Prominent Zimbabwean opposition politician David Coltart tweeted: "We have removed a tyrant but not yet a tyranny."
African Union president Alpha Conde said he was "truly delighted" by the news, but expressed regret at the way Mr Mugabe's rule has ended.
"It is a shame that he is leaving through the back door and that he is forsaken by the parliament," he said.
Robert Mugabe - Timeline of a political life
- 1924: Born in Kutama
- 1964: Imprisoned by Rhodesian government
- 1980: Wins post-independence elections
- 1996: Marries Grace Marufu
- 2000: Loses referendum, pro-Mugabe militias invade white-owned farms and attack opposition supporters
- 2008: Comes second in first round of elections to Morgan Tsvangirai who pulls out of run-off amid nationwide attacks on his supporters
- 2009: Amid economic collapse, swears in Mr Tsvangirai as prime minister, who serves in uneasy government of national unity for four years
- 2017: Sacks long-time ally Vice-President Emmerson Mnangagwa, paving the way for his wife Grace to succeed him. Army intervenes and forces him to step down