The clashes came two days after over 600 people were killed in Egypt as police cleared two Cairo protest camps set up by loyalists of Morsi, in the country's bloodiest day in decades.
That crackdown drew strong condemnation from the international community, and EU foreign affairs chief Catherine Ashton called Friday for the bloc to adopt "appropriate measures" in response.
But Egypt's cabinet issued a defiant statement, even as clashes continued in the hour before a night-time curfew began, saying it was confronting a "terrorist plot".
In Jordan, Morocco and the Palestinian territories, meanwhile, hundreds joined demonstrations in support of Morsi's Muslim Brotherhood movement.
The Islamist coalition led the Brotherhood had called for "Friday of anger" rallies across Egypt in response to the crackdown on their protest camps.
And violence erupted soon after protesters emerged from mosques following Friday prayers, with gunshots ringing out in Cairo and security forces firing tear gas.
In the capital, a man leapt off a bridge near a police station to escape shooting as police armoured vehicles advanced on protesters, witnesses said.
An AFP correspondent counted at least 19 bodies in one Cairo mosque, while eyewitnesses said more than 20 corpses had been laid out in a second mosque.
Security sources and the health ministry reported at least 31 dead, including four in the Suez Canal city of Ismailiya and another eight in northern Damietta.
In Cairo, streets were virtually deserted except for demonstrators and security forces, with the army deploying at key points in the city.
The interior ministry, which on Thursday authorised police to use live fire if government buildings came under attack, accused the Brotherhood of attacking police stations, saying it foiled several attempts to storm buildings.
Marches were also reported in the Mediterranean city of Alexandria, in Beni Sueif and Fayyum, south of Cairo, and in the Red Sea resort town of Hurghada.
Wednesday's bloody crackdown on the pro-Morsi protest camps has polarized Egypt, splintering the army-installed government and drawing forceful international condemnations.
The president of the UN Security Council pleaded for "maximum restraint" after an emergency meeting on Wednesday's violence.
NJF/NJF