Veteran politician Beji Caid Essebsi has been confirmed as winner of Tunisia's first free presidential poll.
He secured 55.68% of the vote in Sunday's run-off, defeating caretaker president Moncef Marzouki (44.32%), the head of the electoral commission said.
Mr Marzouki, a 67-year-old former exile, earlier refused to admit defeat.
Mr Essebsi, 88, has urged all Tunisians to "work together" for stability but critics say his win marks the return of a discredited establishment.
They point out that he served under President Zine el-Abedine Ben Ali, who was ousted in 2011 after the Arab Spring revolution triggered uprisings across the region.
Mr Essebsi was also in the cabinet of Tunisia's first post-independence leader, Habib Bourguiba.
Earlier on Monday, police fired tear gas in the southern city of Hamma to disperse hundreds of demonstrators who burned tyres in protest at Mr Essebsi's victory.
The results of the run-off vote were announced by the head of the electoral commission, Chafik Sarsar, who was visibly emotional.
It is the first time Tunisians have been able to vote freely for their president since independence from France in 1956.
Analysis: Naveena Kottoor in Tunis
Chafik Sarsar - the head of the electoral authority - was visibly emotional and his voice broke several times as he announced the winner of Tunisia's first freely elected president. The former law professor has been under intense pressure to ensure the voting period runs smoothly.
The man who will move into the presidential palace overlooking the bay of Tunis is 88-year-old Beji Caid Essebsi.
The leader of the Nidaa Tounes, which has largest share of seats in the new parliament, has served under two autocratic presidents. Tunisians joke that he and his party represent the old regime, but with an injection of Botox.
Mr Essebsi is politically savvy and pragmatic and has to be credited for agreeing to enter a dialogue last year with his arch-enemies, the moderate Islamist Ennahda party, to resolve a political crisis at the time.
Mr Marzouki earlier criticised Mr Essebsi for declaring victory based on exit polls.
"The announcement of victory is undemocratic and we should wait if we want to be a state that respects the rule of law," he told supporters.
Mr Marzouki has been interim president since 2011 and is more popular in the conservative, poorer south.
He was thought likely to attract support from the moderate Islamist Ennahda party, which has played a key role in Tunisian politics since the Arab Spring but did not field a candidate.
'Martyrs of Tunisia'
On Sunday, Mr Essebsi appeared on television after polls closed: "I dedicate my victory to the martyrs of Tunisia."
"I thank Marzouki, and now we should work together without excluding anyone," he added.
Supporters danced and let off fireworks outside the headquarters of Mr Essebsi's secular-leaning Nidaa Tounes party.
Beji Caid Essebsi
- 88-year-old lawyer and politician
- Studied law in Paris
- Interior minister under Habib Bourguiba, Tunisia's first president after independence
- Speaker of parliament under ousted President Zine el-Abedine Ben Ali
- Interim prime minister in 2011 after the uprising
- Founder of secular-leaning Nidaa Tounes party in 2014
- Supported by Tunisian General Labour Union and some business groups
Mr Essebsi led in the first round of voting last month with 39% of the vote. Mr Marzouki polled 33%.
He is popular in the wealthy, coastal regions, and based his appeal to voters on stability and experience.
The new president will have restricted powers under a constitution passed earlier this year.
He will be commander-in-chief of the armed forces but can appoint or sack senior officers only in consultation with the prime minister.
The president will also set foreign policy in consultation with the prime minister, represent the state and ratify treaties.
Tunisia boosted security for the elections and closed border posts with Libya, which has been plagued by unrest.
- 12 November 2014