"I have decided to submit my resignation to His Majesty the King, with effect from today," Thapa said on Friday.
"I hope my resignation will pave the way for building a national consensus and help establish lasting peace in the country."
Thapa's resignation came a day after a key meeting with international donors who pressed for democratic reforms and urged an end to a Maoist revolt in the aid-dependent country that has claimed over 9000 lives.
Nepal has been in political turmoil since King Gyanendra fired the elected government in 2002, replaced it with a royalist administration and indefinitely postponed elections.
Opposition groups mounted daily street protests demanding the king sack Thapa and restore multi-party democracy, and his departure could pave the way for fresh talks between the king and the opposition.
"I hope my resignation will pave the way for building a national consensus and help establish lasting peace in the country"
Surya Bahadur Thapa,
Nepal's royalist Prime Minister
But much will depend on who the king chooses to replace the 76-year-old Thapa, who was appointed last June.
Maoist rebels have been fighting a bloody revolt since 1996 to replace the monarchy with a communist republic.
Gyanendra said in March he aimed to hold fresh elections by
April 2005 but analysts said a free vote was not possible without peace with the rebels, who walked out of talks last August.