The agreement also mentioned about taking ownership of the past agreements of the dissolved Constituent Assembly regarding the drafting of the constitution.
The CPN-UML had earlier pressed for new elections for president and vice president. However, after reaching a power sharing deal, the party agreed to support Koirala as prime minister.
A patient of throat cancer, Koirala had gone to the US last year for treatment.
Koirala, who is still unmarried, has so far not taken up any administrative post and has no experience of handling a ministry in the past.
“Our party will shoulder the responsibility to conclude the peace process and produce a democratic constitution,” he said ahead of the vote.
“We will take the lead in preparing a draft of the new constitution,” he added.
His candidacy was proposed by the party's vice president Ramchandra Poudyal and CPN-UML Parliamentary Party leader K P Sharma Oli seconded the proposal during the election.
Nepal has been facing a constitutional crisis since the 10-year civil war ended in 2006.
It deepened in 2012 when the first constituent assembly elected in 2008 was dissolved without promulgating the constitution.
The composition of the constituent assembly was delayed after the Maoists alleged fraud in polls and threatened to boycott the parliament.
After weeks of negotiations, they agreed to participate in parliament.