The former centre-right Prime Minister of Portugal, Anibal Cavaco Silva, has won Sunday's presidential election.
Mr Cavaco Silva is Portugal's first conservative president since 1974
Mr Cavaco Silva secured 50.6% of the vote - enough to avoid a run-off.
The politician finished well ahead of the two Socialist candidates, Manuel Alegre and former President and Prime Minister Mario Soares, who came third.
Mr Cavaco Silva is the first centre-right politician to fill the largely ceremonial post of president since Portugal's 1974 revolution.
He told supporters after the results were announced: "The task before us is not small, the work will be long and demanding."
Mr Cavaco Silva vowed to work with the Socialist government, saying: "I know by my own experience the value of cooperation among government bodies."
Mr Soares - the Socialists' official candidate - told supporters: "The results went against my expectations. I accept this defeat with a feeling of mission accomplished."
The BBC's Alison Roberts in Lisbon says that several leading Socialist party officials said afterwards that it must reflect on what had gone wrong.
While Portuguese presidents have limited powers, they appoint prime ministers and can dissolve parliament.
Mr Cavaco Silva was prime minister from 1985 to 1995.
With the economy stagnating, many of the nine million registered voters want a strong leader like Mr Cavaco Silva, an economist with an austere and some say authoritarian image, says the BBC's Alison Roberts in Lisbon.
Our correspondent says his victory will be a defeat for the Socialist government - although Mr Cavaco Silva has said he will back its attempts to adapt the economy to globalisation.
Mr Cavaco Silva will replace President Jorge Sampaio, a Socialist who has served two five-year terms.