Pirc Musar won 54% of the votes, while her rival, right-wing politician and former Foreign Minister Andze Logar, won 46%, according to election commission data with almost all the votes counted, according to DW.
Turnout was 49.9%, the commission said.
Pirc Musar had trailed Logar in the first round of voting two weeks ago. Her victory boosts the country's liberal bloc following the center-left coalition victory in Slovenia's parliamentary election in April.
She will succeed President Borut Pahor, a centrist politician who had already served two terms in office.
"My first task will be to open a dialogue among all Slovenians,'' the new president said.
Pirc Musar, 54, is a former TV presenter who became an influential lawyer. She campaigned on human rights, the rule of law, and social welfare issues.
RHM/PR