Hosni Mubarak has stepped down as president of Egypt, after weeks of protest in Cairo and other cities.
The news was greeted with a huge outburst of joy and celebration by thousands in Cairo's Tahrir Square - the heart of the demonstrations.
Mr Mubarak ruled for 30 years, suppressing dissent and protest, and jailing opponents.
US President Barack Obama said that Egypt must now move to civilian and democratic rule.
This was not the end but the beginning and there were difficult days ahead, the US president added, but he was confident the people could find the answers.
"The people of Egypt have spoken, their voices have been heard," Mr Obama said. "Egypt will never be the same again."
"They have made it clear that nothing less than genuine democracy will carry the day."
'God help everybody'
Announcing Mr Mubarak's resignation, Vice-President Omar Suleiman said the president had handed power to the army.
Mr Suleiman said on state TV that the high command of the armed forces had taken over.
"In the name of God the merciful, the compassionate, citizens, during these very difficult circumstances Egypt is going through, President Hosni Mubarak has decided to step down from the office of president of the republic and has charged the high council of the armed forces to administer the affairs of the country," he said.
"May God help everybody."
Later an army officer read out 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.
US diplomatic cables published by Wikileaks described Field Marshal Tantawi as "aged and change-resistant", but committed to avoiding another war with Israel.
Mr Mubarak has already left Cairo and is in the Red Sea resort of Sharm el-Sheikh where he has a residence, officials say.
In Cairo, thousands of people gathered outside the presidential palace, in Tahrir Square and at state TV.
They came out in anger following an address by Mr Mubarak on Thursday. He had been expected to announce his resignation but stopped short of stepping down, instead transferring most powers to Mr Suleiman.
"The people have brought down the regime," they chanted in reaction to the news of his eventual resignation less than 24 hours later.
Opposition leader Mohamed ElBaradei said: "This is the greatest day of my life."
"You cannot comprehend the amount of joy and happiness of every Egyptian at the restoration of our humanity and our freedom."
The Muslim Brotherhood, Egypt's banned Islamist opposition movement, paid tribute to the army for keeping its promises.
"I salute the Egyptian people and the martyrs. This is the day of victory for the Egyptian people. The main goal of the revolution has been achieved," said the Brotherhood's former parliamentary leader, Mohamed el-Katatni.
Ayman Nour, Mr Mubarak's rival for the presidency in 2005, described it as the greatest day in Egypt's history.
"This nation has been born again. These people have been born again, and this is a new Egypt," he told al-Jazeera TV.
Meanwhile Amr Moussa, a former Egyptian foreign minister, announced that he would leave his post as secretary general of the Arab League "within weeks", the Egyptian news agency Mena reported. He hinted that he might stand for president.
The BBC's Jon Leyne in Cairo said the announcement caught everyone by surprise: all over the city, drivers honked their horns and people fired guns into the air.
But the army takeover looks very much like a military coup, our correspondent adds.
The constitution has been breached, he says, because officially it should be the speaker of parliament who takes over, not the army leadership.
There was jubilation throughout the Middle East and North Africa, including in Tunisia, where people overthrew their own president last month.
For the Arab League, Mr Moussa said events in Egypt presented an opportunity to build a national consensus.
Meanwhile, Iran described the recent events as a "great victory".
A senior Israeli official expressed the hope that Mr Mubarak's departure would "bring no change to its peaceful relations with Cairo".
UN Secretary General Ban Ki-moon said he respected the "difficult decision" taken in the people's interests, and called for an "orderly and peaceful transition".
European Union leaders reacted positively to the news of Mr Mubarak's resignation.
Foreign policy chief Baroness Ashton said the EU "respected" the decision.
"It is important now that the dialogue is accelerated leading to a broad-based government which will respect the aspirations of, and deliver stability for, the Egyptian people," she said.
UK Prime Minister David Cameron said this was a "really precious moment of opportunity to have a government that can bring the people together", and called for a "move to civilian and democratic rule".
German Chancellor Angela Merkel welcomed the "historic change" in Egypt.
US Vice-President Joe Biden said Egypt had reached a pivotal moment in history.
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.