Pahor is a member of the opposition Social Democrats, and has called for cooperation between the government and opposition to tackle the economic crisis and prevent Slovenia becoming the latest member of the 17-member currency union to seek a bailout.
In a run-off vote, Pahor won 67.4%, ahead of incumbent Danilo Turk on 32.6% with 99.7% of votes counted, the state Electoral Commission said.
"There is almost no problem that we cannot solve together," Pahor, who was prime minister from 2008 to 2011, told reporters after exit polls indicated he had won.
"It is my proposal that we reach a political agreement of all parliamentary parties," he said.
The country of 2 million people has been hit by a wave of protests in recent weeks over public sector spending cuts and alleged corruption.
The presidency in Slovenia is largely ceremonial with few real powers. One of Pahor's duties will be to nominate a new central bank governor who will sit on the European Central Bank's governing council after governor Marko Kranjec's mandate expires in June 2013.
The conservative government of Prime Minister Janez Jansa plans to raise the retirement age, ease rules on hiring and firing workers, cut public sector wages and social benefits and speed up the sell-off of state assets to rein in a budget deficit projected at 4.2% of national output this year.
But the policy has been challenged by some political opponents and trade unionists. Last year several reform bills prepared by the previous center-left government were rejected in referendums demanded by trade and students' unions and the opposition, helping bring down Pahor's administration.
"Pahor won because he is a good speaker and because he urges cooperation between the government and the opposition," said Meta Roglic, a political analyst at the Slovenian daily Dnevnik. "But he himself does not have the power to ensure such cooperation."
Slovenia, which adopted the euro in 2007 and has an export-driven economy, was badly hit by the global crisis and fell back into recession in the third quarter of this year amid lower export demand and budget cuts.
Last month it managed to issue its first sovereign bond in 19 months, staving off the need for a bailout for at least another six months.