President Hosni Mubarak of Egypt has stepped down and handed power to the Supreme Council of the Armed Forces.
A brief statement was made on State television by Vice President Omar Suleiman on Friday.
Protesters in Cairo responded by cheering, waving flags, embracing and sounding car horns. The people have brought down the regime, they chanted.
Mr Mubarak, 82, had ruled for 30 years. He came to power after the assassination of President Anwar Sadat in 1981.
After protests in other Arab countries, national protests began in Egypt on 25 January.
The relentless rallies against poverty, corruption and repression caused support from the armed forces for him to evaporate.
Large numbers of people have gathered in Tahrir Square in Cairo for days, demanding that he depart.
Renewed marches began after the end of the Friday prayers at midday. There were also large protests in other cities.
Hundreds of thousands of protesters in central Cairo waved flags, cried, cheered and embraced in celebration when the resignation was announced.
Mr Mubarak on Thurday angered the demonstrators by reiterating he would not step down immediately as they demanded, and would stay in office until elections in September. He transferred most of his powers to Vice President Suleiman.
Earlier on Friday, the military high council promised to lift a state of emergency which has been in force for 30 years, when what it called 'the current situation' has ended.
The army said that it endorsed the transfer of Mr Mubarak's powers to the vice president and guaranteed a free and fair presidential election.
Mr Mubarak and his family reportedly left Cairo earlier in the day for a residence in the Red Sea resort of Sharm el-Sheikh.
The Army has endorsed the transfer of President Mubarak's powers to General Suleiman and guaranteed a free and fair presidential election, constitutional changes and protection of the nation.
In what it called Communique No 2, the army also urged the need to resume orderly work in the government installations and a return to normal life, preserve the interests and property of our great people.
Later an army officer read a statement paying tribute to Mr Mubarak for what he has given to Egypt but acknowledging popular power.
There is no legitimacy other than that of the people, the statement said.
The military high command is headed by Defence Minister Mohamed Hussein Tantawi.
The lifting of Egypt's state of emergency has been a key demand of the protesters.
The anti-government protests that began on 25 January were triggered by widespread unrest in Egypt over unemployment, poverty and corruption.
They followed a popular uprising in Tunisia which brought about the downfall of President Zine al-Abidine Ben Ali. He fled to Saudi Arabia on 14 January, after 23 years in power.
A BBC correspondent reports the army takeover looks very much like a military coup.
Vice president Suleiman said Mr Mubarak had handed power to the high command of the armed forces.
President Mohammed Hosni Mubarak has decided to leave the post of president of the republic and has tasked the Supreme Council of the Armed Forces to manage the state's affairs, he said. May God help everybody.
The Muslim Brotherhood has hailed Mr Mubarak's resignation and thanked the army.
The BBC's world affairs editor says the stubbornness of one elderly man was pitted against the will of millions for 18 days.
The Egyptian army found itself in the middle, unwilling until the very end to force President Mubarak out, yet deeply hostile to any suggestion that the soldiers should remove the demonstrators from Tahrir Square in Cairo by force.
It is still too soon to know for certain what made Mr Mubarak step down, but it seems a reasonable assumption that the army leadership could see the hairline cracks appearing among their own officer corps.
The generals were inclined to side with the president, one of their own, and the more junior officers sympathised with the demonstrators.
There was an historical echo to that. In 1952, many of the senior officers preferred the monarchy, while the younger ones, including a young colonel called Gamal Abdel Nasser, favoured a successful coup against the old system.
There have only been two presidents since Colonel Nasser: Anwar Sadat and Hosni Mubarak, who took over when Sadat was murdered.