The vote was called after Pushpa Kamal Dahal’s old coalition allies pulled out of the government over the choice of a new president.
His old coalition allies pulled out of the government last month after he chose an opposition candidate to become the next president. Prime ministers have to face confidence votes after any ally withdraws support.
Dahal – a former chief Maoist rebel commander who still goes by the nom de guerre Prachanda, meaning “fierce” – is expected to unveil a coalition this week with the Nepali Congress party and nine other smaller groups including his Maoist Centre party.
He got 172 votes in his favour on Monday and 89 against in the 275-seat parliament, Speaker Devraj Ghimire said.
”I promise to work firmly for social justice, good governance and prosperity, turning the trust you have given into energy,” Dahal wrote on Twitter after the result.
The 68-year-old became prime minister in December for the third time, heading a coalition with the liberal Communist Unified Marxist-Leninist (UML) party and royalists.
The allies left amid differences over his support for Ram Chandra Paudel, a nominee of the Nepali Congress party, for president.
Paudel was elected on March 9 as the third president of the republic of 30 million people nestled between China and India.
Nepal has had 11 governments since it abolished its 239-year-old monarchy in 2008 and became a republic. The president is a largely ceremonial head of state.
Analysts said Dahal could face challenges forming his new cabinet. “It could be difficult for the prime minister to distribute ministerial positions and satisfy the ambitious allies,” Bipin Adhikari, a constitutional expert, told Reuters news agency.
Dahal is already in the middle of another crisis. The Supreme Court is hearing a petition demanding his arrest and an investigation into his leadership during a decade-long civil war that killed thousands of people before it ended in 2006.
In a public gathering three years ago, Dahal said he was ready to take responsibility for 5,000 deaths during the civil war, blaming the then state forces for the remaining fatalities.