Tunis - Beji Caid Essebsi, Tunisia's first democratically elected president, died on Thursday at a military hospital in the capital Tunis, after being admitted the night before.
The 92-year-old took office almost five years ago.
Essebsi died on Thursday morning, the presidency said in a statement.
Hours later, parliamentary Speaker Mohamed Ennaceur was sworn in as interim president. The 2014 constitution states that the parliament head can take office for a maximum period of 90 days.
Ennaceur, 85, took the oath of office in the parliament's premises in Tunis due to the absence of a Constitutional Court, which would have been tasked with declaring the presidency vacant so that an interim president can take over.
This might lead the electoral commission to bring forward the country's presidential vote, originally scheduled for November 12.
A funeral for Essebsi will be held on Saturday, Tunisian Foreign Minister Khamis al-Jahnawi told the state news agency TAP.
Late last month, Essebsi was hospitalised for four days due to a severe illness. Since then, he has made few appearances in public.
He recently signed a decree to kick off procedures for legislative and presidential elections scheduled for later this year.
He looked frail in his last appearance on Monday when he met with Defence Minister Abdelkarim Zbidi.
Prime Minister Youssef Chahed declared a seven-day mourning period and ordered flags at state institutions to be lowered to half-mast.
Cultural and sports events have been halted until further notice, TAP reported.
Tunisian television stations have interrupted their broadcast to air recitations from the Koran.
Chahed mourned Essebsi saying he had "a pivotal role in the success of the democratic transition."
Condolence messages poured in following his death.
Rached Ghannouchi, the head of Tunisia's Islamist Ennahda movement, expressed his sorrow for Essebsi's death, saying the late president had made significant contributions to building the state.
Italian Prime Minister Giuseppe Conte, on Twitter, saluted Essebsi as "a man and statesman with great political experience and humanity, who served his country throughout his life" and expressed "sincere condolences to his family and all of Tunisia."
Tunisia lost one of its most "competent" and "courageous" leaders, EU foreign policy chief Federica Mogherini said in a statement.
The upcoming presidential elections will be Tunisia's third after the 2011 uprising that toppled long-time dictator Zine El Abidine Ben Ali.
Parliamentary elections are scheduled to be held in October.Dpa