Koirala, the sole contestant in the premier race, was elected with 405 votes in the 601-member Constituent Assembly. (Agencies)
As many as 148 lawmakers from UCPN-Maoist, Rastriya Prajatantra Party-Nepal and some small parties in the Maoist-led alliance voted against 75-year-old Koirala.
After the voting, Parliament Speaker Surya Bahadur Thapa declared that Koirala had secured the majority. The announcement was followed by applause inside the hall.
Koirala is scheduled to be sworn-in by the President later on Monday. He is also expected to announce a small Cabinet and continue negotiations with other political parties to join his coalition government.
The standing committee of CPN-UML - the second largest party which has 173 lawmakers - backed Koirala for the top post after the party reached a six-point deal with the NC, which as 194 lawmakers.
The two largest parties in the Constituent Assembly inked the deal on Sunday after several rounds of negotiations on the issue of power sharing.
Under the six-point agreement, they agreed to promulgate the new Constitution within a year and to hold elections for the posts of president, vice president and chairman of the Constituent Assembly after it approves the new Constitution.
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 the Prime Minister.
Koirala, the sole contestant in the premier race, was elected with 405 votes in the 601-member Constituent Assembly.