Deuba, the president of Nepal's oldest party, the Nepali Congress, was elected the 40th prime minister, following a voting in the parliament. He secured 388 votes out of a total of 558 votes cast in the 601-member legislative parliament.
The 70-year-old was the only contender in the election.
He succeeds Maoist leader Pushpa Kamal Dahal 'Prachanda', who last month resigned as prime minister after nine months to honour a power-sharing deal and proposed Deuba's name.
Following his election, Deuba pledged to carry forward the process of Constitution implementation. He said political parties "should work together" to implement the Constitution.
More From This Section
Deuba said conducting the second phase of the local level elections on June 28 will be a priority of his government.
He takes over at a crucial time in the politics of Nepal, which is holding the first local-level polls in 20 years, but one that is being resisted by the Madhesi people.
The inhabitants of the southern Terai region, who share cultural ties with Indians, have been demanding more political representation and were until recently boycotted the polls.
He played an important role in amending Nepal's Constitution promulgated in September 2015 to address the demands of Madhes-based political parties. Deuba also played a key role in bringing the Madhesi parties on board for the second phase of the local-level elections.
Deuba, who has been elected to the parliament from far- western Dadeldhura district, has promised to amend the new Constitution to fulfil the demands of the Madhesi people.
He served as the prime minister from 1995 to 1997, from 2001 to 2002, and from 2004 to 2005. His political career has gone through several ups and downs through this period.
Nepal's then king Gyanendra Shah took power through a coup detat in October 2002 and removed Deuba from the premiership. But the king had to restore him in 2004 after weeks of street protests.
Deuba was again removed from power by the king in 2005, when he was also imprisoned on charges of corruption.
But the new party merged into the parent party after Koirala and Deuba reached an agreement in 2007.
Earlier today, Deuba addressed the parliament before the voting. He said he would accord priority to complete the local polls and conduct provincial and parliamentary elections by March next year.
He said he would also prioritise the amendment of the Constitution to address the demands of the Madhesi people.
"My other priorities will be economic reforms and rapid development of the country and for that I would focus on developing infrastructure such as electricity, transportation and irrigation," Deuba said.