54-year-old Bhandari, the Vice-president of CPN-UML and widow of late general secretary of the party Madan Bhandari, secured 327 votes against 214 votes of her rival veteran Nepali Congress leader Kul Bahadur Gurung.
"I announce that Vidya Devi Bhandari has been elected to the post of Nepal's president," Speaker Onsari Gharti Magar said, to loud cheers from lawmakers.
She succeeds incumbent Ram Baran Yadav who was elected as the country's first President in 2008 after Nepal was declared a Republic following the abolition of a 240-year-old monarchy.
In her first public statement as the President, Bhandari said the new Constitution would work for Nepal's sovereignty and independence during her tenure.
More From This Section
She said the charter promulgated from the Constituent Assembly last month would protect sovereignty, independence and territorial integrity.
Bhandari said her election was a step ahead in the process of implementing the Constitution as per its spirit.
Her victory was almost certain as 12 ruling parties including the third and fourth largest parties - UCPN (Maoist) and Rastriya Prajatantra Party-Nepal (RPP-N) - had pledged their support. Gurung received votes only from NC lawmakers.
The president is the ceremonial head in Nepal while the prime minister is the nation's leader.
Bhandari began her political career with a leftist student movement in 1979. She then acquired membership of CPN (ML), went underground and fought against the party-less Panchayat system from Morang district.
She married the famed Communist leader Madan Kumar Bhandari.
After the end of Panchayat system and restoration of multi-party democracy in 1990, CPN (ML) became CPN (UML) after unification with CPN (Marxist) and her husband became General Secretary of the unified party.