Pinto da Costa won 52.88% of votes in Sunday's run-off in the African archipelago, ahead of 47.12% for parliament speaker and former prime minister Evaristo Carvalho, the national election commission announced.
Nearly 26% of voters had not cast their ballots, the commission said.
The results have to be validated by the constitutional court, with the new president due to take over the small island nation off the west coast of Africa on September 3.
Both contenders had campaigned on bringing stability to the impoverished nation, which has seen several coup attempts and 18 prime ministers since democracy in 1990.
Pinto da Costa, 74, ruled Sao Tome with an iron fist for 15 years after independence from Portugal in 1975, and observers had warned his return to power could herald a slide towards authoritarianism.
He lost the presidency after introducing reforms in 1990, including multi-party democracy that saw the election as president of Miguel Trovoada, father of the current prime minister, supporter of the defeated Evaristo.
Sunday's voting was smooth, with Pinto da Costa expected to come out on top following a comfortable win in the first round of voting last month.
Many of the defeated first-round contenders had urged their supporters to back Pinto da Costa, saying they preferred his social plan for the cocoa-producing nation, which is expected to begin drilling in the coming years.
Corruption and poverty
But Evaristo, 70, had been confident of success.
"I am convinced I will win the election. I hope people will flock to polling stations in orderly fashion," he said when he cast his ballot in Sao Tome city centre on Sunday.
Under Sao Tome law, outgoing President Fradique de Menezes, who was elected in 2001 and reelected in 2006, cannot seek a third mandate.
Sao Tome is a rare case of a Gulf of Guinea nation that does not export oil but diplomats say production could start in 2014. It relies on foreign aid for 80 percent of its budget.
Evaristo, prime minister under Miguel Trovoada and De Menezes, is from the Independent Democratic Action (ADI) party, which won 2010 parliamentary elections, and said his political backing meant he could ensure stability.
"I know Prime Minister Patrice Trovoada well. I know the government programme of the ADI. All that offers me the opportunity to ensure an institutional relationship of stability for the development of the country," he said during campaigning.
But more voters appear to have been convinced by Pinto da Costa, who had also vowed to tackle corruption plaguing the country, one of the poorest in the world.
"I am going to do everything I can to put the country on the path of development, overcoming instability, poverty and corruption. It is possible," he said ahead of the vote.