Tunisian Prime Minister Mohammed Ghannouchi has announced on state TV that he is resigning - a key demand of demonstrators.
He was speaking at a news conference in Tunis, after making a lengthy speech defending his record in government.
Mr Ghannouchi is seen as being too close to former President Zine al-Abidine Ben Ali, who was toppled in an uprising last month.
Mr Ghannouchi, 69, had served under Mr Ben Ali since 1989.
"After having taken more than one week of thinking, I became convinced, and my family shared my conviction, and decided to resign. It is not fleeing my responsibilities; I have been shouldering my responsibilities since 14 January [when Mr Ben Ali fled]," he said.
"I am not ready to be the person who takes decisions that would end up causing casualties," he added.
"This resignation will s
Tunisia," he added.
Within hours a replacement was named for Mr Ghannouchi - Beji Caid-Essebsi, 84, who served as foreign minister in the government of the late President Habib Bourguiba.
Earlier in the day, police in Tunis fired tear gas and warning shots to disperse the latest demonstration calling for a new government and a new constitution on a third day of violence.
On Friday and Saturday, anti-government protesters held huge rallies calling for Mr Ghannouchi's resignation.
At least three people were killed in clashes between hundreds of demonstrators and security forces in Tunis on Saturday.
Tunisia's government had insisted it was introducing reforms as fast as it could, and that it was planning to hold elections by July.
But those promises did not seem to satisfy the protesters, correspondents say.
The fall of Mr Ben Ali after 23 years in power sparked similar uprisings in the Arab world, including one that led to the downfall of long-time Egyptian President Hosni Mubarak on 11 February and another under way in Libya.
The trigger for the protests in Tunisia was a desperate act by a young unemployed man on 17 December 2010.
Mohammed Bouazizi set fire to himself when officials in his town prevented him from selling vegetables on the streets of Sidi Bouzid without permission.