Bidhya Devi Bhandari of the Communist Party of Nepal Unified Marxist-Leninist received 327 votes against her opponent's 214 in parliament on Wednesday.
The president is the ceremonial head in Nepal while the prime minister is the nation's leader.
Bhandari, 54, is the deputy leader of the party led by Prime Minister Khadga Prasad Oli, who was elected earlier this month and leads a coalition government.
The new constitution adopted last month required Nepal to name a new president.
Bhandari was among the politicians who campaigned to ensure that women's rights were enshrined in the new constitution.
News that makes sense
Your trusted source for staying up-to-date with the world around you. Get free daily news updates and analysis, straight to your inbox.
The document says one-third of the members in parliament have to be women and either the president or vice president must be a woman.
Nepal is traditionally a male-dominated society with women limited to work in homes or on farms, but the country has been trying to grant more rights for women.
Just last week, Onsari Gharti was elected the first female Parliament speaker.
The new constitution adopted last month also says women need to be included in all government committees and assemblies including parliament and state assemblies.

