Somalia's interim Prime Minister Ali Mohamad Ghedi has entered the capital, Mogadishu, heading an armoured convoy.
Mr Ghedi has been greeting supporters in several towns
His arrival came a day after his Ethiopian-backed forces drove Islamist fighters out of the city.
Reports said cheering crowds lined the streets to welcome Mr Ghedi, who has declared three-months of martial law.
But some are opposed to Ethiopia's role in Somalia, with thousands protesting in Mogadishu as Ethiopian soldiers secured the city's port and airport.
Some protesters threw stones as convoys passed into Mogadishu, but after shots were fired into the air their way was uninterrupted and other people cheered.
Correspondents say Mr Ghedi's arrival in Mogadishu marks the first time the country's transitional government has been in a position to exercise full authority in the capital.
Speaking in Mogadishu, Mr Ghedi said he believed most of the UIC's forces were destroyed in the fighting.
"Today is the beginning of a new life, new stabilisation and a new future for Somalia," the Associated Press news agency quoted him as saying.
Several thousands militiamen loyal to the UIC have now abandoned the city for their last stronghold in the port of Kismayo, 500km (300 miles) to the south.
But a leader of the Islamists who fled says they will never leave Somalia.
The BBC's Mohamed Olad Hassan in Mogadishu said the city appeared calm as night fell at the start of the Islamic Eid holiday.
But earlier there were large demonstrations, with thousands of people protesting against Ethiopian troops.
Ethiopian-backed troops have already taken control of the UIC's headquarters in the north and the former US embassy compound in the south.
Mr Ghedi, previously based in the central town of Baidoa, held talks with clan leaders on the outskirts of Mogadishu before entering the capital.
"This country has experienced anarchy and in order to restore security we need a strong hand, especially with freelance militias," he said.
There have already been reports of gunfire and looting since Islamist forces left.
Meanwhile, Ethiopia's Foreign Minister Seyoum Mesfin has flown by helicopter to Baidoa for talks.
He said the situation in Somalia was stable and very promising.
There is fierce opposition to Ethiopia in northern Mogadishu
The African Union has called for Ethiopian forces to leave Somalia, but the United Nations Security Council failed to agree on a statement calling for the withdrawal of all foreign forces.
Much of Somalia faces food shortages because of recent heavy floods.
The UN says its aid flights are due to resume on Saturday, after being suspended during the past week because of the fighting.
The UN estimates that about 30,000 people have been displaced during the fighting and causalities have been high.
Hundreds of young people have been killed and some 800 people, mainly on the Islamic side, have been treated in hospital, a UN official said.
And more than 150 refugees on board boats that capsized off the coast of Yemen on Thursday are all presumed dead, the UN refugee agency said.
The UIC assumed control of the capital in June, driving warlords out and rapidly extending their influence to much of southern Somalia
Some analysts say the UIC's popularity stemmed from their ability to transcend clan enmities that have bedevilled Somalia since the overthrow of former President Mohamed Siad Barre in 1991.
Almost all Somalis are Muslim, and after years of lawlessness many were happy to have some kind of law and order under the UIC.
But some are wary of the hardline elements among the UIC.
The UIC have staged public executions and floggings of people they have found guilty of crimes such as murder and selling drugs.