Oli, 62 and a former deputy premier of the country, defeated his rival Madhav Kumar Nepal, a former prime minister and a general secretary of the CPN (UML) for 15 years, by a mere 44 votes.
"Oli secured 1,047 votes while Nepal got 1,003 votes," CPN-UML leader Pradip Gyawali said.
Oli had suffered defeat at the hands of outgoing chairman Jhala Nath Khanal at the party's eighth general convention in 2009 while vying for the top post.
According to the party statute, immediate past chairman Khanal automatically becomes a party office-bearer with a position second only to the chairman in the party hierarchy.
The voting for the selection of the new leadership and 159 central committee members was conducted last Friday when a total of 2,154 party representatives cast their votes.
According to the election committee, Bamdev Gautam, who is also Nepal's deputy prime minister, Bidhya Bhandari, Yubraj Gyawali, Astha Laxmi Shakya and Bhim Rawal have been elected vice-chairpersons.
Incumbent general secretary Ishwar Pokharel has again been elected to the same position, defeating his rival Surendra Pandey.
Similarly, Ghanashyam Bhusal and Bishnu Poudel have been elected as deputy general secretaries.