“I have decided to quit as prime minister,” Ghannouchi told a news conference.
“I am not ready to be the person who takes decisions that would end up causing casualties,” Ghannouchi said.
“This resignation will serve Tunisia, and the revolution and the future of Tunisia,” he added.
The resignation comes after fresh clashes in Tunis left three people dead and dozens more wounded. Over 100 others were detained on Saturday.
Police also used tear gas to disperse demonstrators out to demand the resignation of Ghannouchi’s transitional government.
Ghannouchi – the premier of the ousted president Zine El Abidine Ben Ali — had been tasked with leading a caretaker government until elections are held.
His resignation was one of the main demands of protesters, who fear their revolution could be hijacked by Western-backed figures.
Ghannouchi’s government has announced, in response to the growing protests, that it will hold elections by mid-July.
They say they do not want any members of the ruling party in the post-revolution government.
On Friday, tens of thousands of Tunisians took to the streets, calling on Ghannouchi to step down and hand over power to an elected government.
The revolution that ousted Ben Ali after 23 years in power has sparked off other popular uprisings in North African and Middle Eastern countries. One of them led to the downfall of long-time Egyptian president Hosni Mubarak.