Samia Suluhu Hassan was sworn in on Friday as Tanzania's first female president after John Magufuli died from heart failure.
The 61-year-old, dressed in black suit and red headscarf, took the oath of office in Dar es Salaam before inspecting troops at a military parade and receiving a cannon salute.
The inauguration was witnessed by members of the Cabinet and Tanzania's former presidents Ali Hassan Mwinyi, Jakaya Kikwete and Abeid Karume. The former heads of state were the only ones in the room wearing facemasks to protect against COVID-19.
Hassan then went outside to inspect a military guard of honour.
"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.
Hassan's inauguration comes two days after she announced the death of President John Magufuli, who had not been seen in public for more than two weeks. In her first public address, she announced 21 days of mourning for Magufuli and public holidays on March 22 and on his burial day which will be on March 25.
``"It's not a good day for me to talk to you because I have a wound in my heart,`` said Hassan. ``Today I have taken an oath different from the rest that I have taken in my career. Those were taken in happiness. Today I took the highest oath of office in mourning,'' she said.
She said that Magufuli ``who always liked teaching'' had prepared her for the task ahead. ``Nothing shall go wrong,'' she assured, urging all the country's people to work to unite the nation.
``"This is the time to stand together and get connected. It's time to bury our differences, show love to one another and look forward with confidence,`` she said. ``It is not the time to point fingers at each other but to hold hands and move forward to build the new Tanzania that President Magufuli aspired to.''
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 is the only other current serving female head of state in Africa alongside Ethiopia's President Sahle-Work Zewde, whose role is mainly ceremonial.¨
She must consult the party about appointing a new vice president. Analysts say she could face pressure from powerful Magufuli allies within the CCM, who dominate intelligence and other critical aspects of government, and could try and influence her decisions.
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.
Questions remain over the true cause of his death, after multiple rumours he had COVID-19 or had sought treatment abroad.