Ms Bhandari, currently the vice-chair of the ruling Communist Party of Nepal (Unified Marxist Leninist), defeated her opponent Kul Bahadur Gurung of the Nepali Congress by securing 327 to 214 votes to become the Himalayan nation's ceremonial head of state.
A former defence minister, Ms Bhandari is a cancer survivor and widow of late communist leader Madan Bhandari, who died in 1991 in a yet unexplained road accident.
The incumbent, Ram Baran Yadav, who belonged to Nepali Congress, was elected president in 2008 after the first elections to the Constituent Assembly.
Under the country's new republican federal Constitution, promulgated on September 20, it was mandatory to elect new president and vice-president, prime minister, and parliament speaker and deputy speaker.
"I announce that Bidhya Devi Bhandari has been elected to the post of Nepal's president," said Speaker Onsari Gharti Magar, to loud cheers from lawmakers.
Ms Bhandari, a rare female face in Nepal's parliament, took up politics in her teens, seeking to overturn the absolute monarchy and later marrying a fellow communist, Madan Bhandari.
But it was after her husband's death in a vehicle accident in 1993 that the mother of two became a prominent voice, riding a wave of sympathy to win a seat in parliament.
Mr Yadav was initially supposed to hold office for only two years. But years of political wrangling delayed agreement on a new constitution, which was only finally adopted last month.
Ms Bhandari, 54, is the second woman to be elected to a senior position since then, after Ms Magar became the country's first female Speaker of the parliament.
As required by the new charter, parliament also this month elected a new prime minister, KP Sharma Oli, who is tasked with unifying the earthquake-hit country.
The constitution, the first drawn up by elected representatives, was meant to cement peace and bolster Nepal's transformation to a democratic republic after decades of political instability and a 10-year Maoist insurgency.
But it has instead sparked deadly violence.
More than 40 people have been killed in clashes between police and ethnic minority protesters, who say a new federal structure laid out in the charter adopted last month will leave them under-represented in parliament.
Work on the constitution began in 2008 after Maoist rebels laid down arms and entered politics, winning parliamentary elections and abolishing the monarchy. But power-sharing squabbles between parties stymied progress.
Lawmakers finally reached agreement in June, spurred by the massive earthquake two months earlier that killed nearly 8,900 people and left more than half a million people homeless.
Get Breaking news, live coverage, and Latest News from India and around the world on NDTV.com. Catch all the Live TV action on NDTV 24x7 and NDTV India. Like us on Facebook or follow us on Twitter and Instagram for latest news and live news updates.