Samia Suluhu Hassan was sworn in on Friday as Tanzania's first female president after the sudden death of John Magufuli from a heart condition called atrial fibrillation.
Several past and current leaders were present as she took oath of office to become the Sixth president.
This was the first time Tanzania's top leadership has changed hands without having an election.
Those present included former Presidents Jakaya Kikwete and Ali Hassan Mwinyi, also present were the Prime Minister Kassim Majaliwa, Speaker of Parliament Job Ndugai, Chief Justice Ibrahim Hamis Juma and many others.
The 61-year-old, dressed in black suit and red headscarf, took the oath of office in Dar es Salaam before inspecting a guard of honour and receiving a 21-gun salute.
"I, Samia Suluhu Hassan, promise to be honest and obey and protect the constitution of Tanzania," she said before a room of dignitaries, who applauded when the brief ceremony was complete.
Under the constitution, Hassan will serve the remainder of Magufuli's second five-year term, which does not expire until 2025.
She is the only other current serving female head of state in Africa alongside Ethiopia's President Sahle-Work Zewde, whose role is mainly ceremonial.
Hailing from Zanzibar, the semi-autonomous island in the Indian Ocean, Hassan rose through the ranks over a 20-year political career from local government to the national assembly.
A stalwart in the ruling Chama Cha Mapinduzi (CCM), she was named Magufuli's running mate in the 2015 presidential campaign.
The pair were re-elected in October last year in a disputed poll marred by allegations of irregularities.
She must consult the party about appointing a new vice president.
Hassan was little known outside Tanzania until she appeared on state television on Wednesday night to announce that Magufuli had died aged 61 from a heart condition after a mysterious three-week absence from public view.