Portugal’s voters elected a veteran center-right politician and television commentator as their new president on Sunday, two months after a Socialist administration took office following inconclusive parliamentary elections.

The new president, Marcelo Rebelo de Sousa, won 52 percent of the votes, with 98 percent counted. He entered the contest as the clear favorite against nine other candidates, which also helped increase his chances by fracturing the left-wing electorate. His closest rival, António Sampaio da Nóvoa, won just under 23 percent of the votes.

The victory of Mr. Rebelo de Sousa, 67, comes at a time of political fragility in Portugal, which has raised the importance of a presidential office that is normally largely ceremonial. As a center-right president, Mr. Rebelo de Sousa could also act as a counterbalance to the Socialist government of António Costa, who became prime minister in November after forming an unexpected alliance with more radical left-wing parties in order to oust the governing center-right coalition.

Since his election, however, Mr. Costa has struggled to keep his coalition together. He has been torn between a commitment to budgetary discipline to meet Portugal’s European fiscal commitments and the reversal of spending cuts, as part of an anti-austerity agenda demanded by left-wing lawmakers.