The former defence minister defeated her opponent Kul Bahadur Gurung by 327 to 214 votes to become the Himalayan nation's ceremonial head of state.
Bhandari, the vice-chair of the ruling Communist Party of Nepal (Unified Marxist Leninist), replaces Ram Baran Yadav.
He was elected as the first president in 2008 following the abolition of a 240-year-old Hindu monarchy.
"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.
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.
Nepal elects first woman speaker in parliament
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.
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.
Bhandari, 54, is the second woman to be elected to a senior position since then, after Magar became the country's first female Speaker.
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.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ