Hosni Mubarak has decided to step down as president of Egypt.
In an announcement on state TV, Vice-President Omar Suleiman said Mr Mubarak had handed power to the military.
It came as thousands massed in Cairo and other Egyptian cities for an 18th day of protest to demand Mr Mubarak's resignation.
Protesters responded by cheering, waving flags, embracing and sounding car horns. "The people have brought down the regime," they chanted.
Mr Suleiman said Mr Mubarak had handed power to the high command of the armed forces.
"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.
Military sources said the military high command was headed by Defence Minister Mohamed Hussein Tantawi.
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 are 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 resgination but instead stopped short of stepping down, transferring most powers to Mr Suleiman.
The BBC's Jon Leyne in Cairo said the announcement caught everyone by surprise, and 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.
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.