Somalia's Ethiopian-backed government says it controls the southern port city of Kismayo - which was the last stronghold of Islamist militiamen.
The Somali army is backed by Ethiopian heavy weaponry
The Islamists retreated as the army, supported by Ethiopian aircraft, tanks and artillery advanced on the city.
The Somali prime minister urged the African Union to send peacekeepers and offered an amnesty to Islamic fighters.
The Islamists had swept through Somalia last year, and their retreat from Kismayo is seen as a major reversal.
Somali Prime Minister Ali Mohamed Ghedi told AFP news agency: "Kismayo is already in the hands of the government. The Islamists have run away."
The Union of Islamic Courts (UIC) had withdrawn to Kismayo on Thursday, after abandoning the capital Mogadishu.
Mr Ghedi offered an amnesty to Islamist fighters who handed over their weapons, saying they had been "misled by international terrorists".
However he stressed that there would be no amnesty for leaders of the UIC.
The prime minister also called on the African Union (AU) to help stabilise the country.
"We would like the military observers and peacekeepers to come in to help us as soon as possible," he told reporters.
Reports say Ethiopian forces are advancing cautiously into Kismayo, fearing mines and booby traps.
The militias are reportedly retreating south towards the border with Kenya, where security has been reinforced on the Kenyan side in an effort to prevent them from crossing over.
Ethiopian aircraft and artillery are backing Somalia's government
Kenyan President Mwai Kibaki has called for a summit of East African countries to discuss the situation.
An Islamic commander, Sheikh Yaqub Ishak, confirmed his forces had left Kismayo, but said they would not "stop fighting the Ethiopian invader".
The Islamists have rejected offers of talks with the government, saying Ethiopia must withdraw its forces first.
Ethiopian troops officially entered Somalia on 24 December, joining fighters loyal to Somalia's interim government, to repel an Islamist assault on the government stronghold of Baidoa.
Ethiopia accuses the UIC of harbouring al-Qaeda militants. This is denied by the militia.
The UIC assumed control of the capital in June, driving warlords out and rapidly extending its influence to much of central and southern Somalia.
Some analysts say the UIC's popularity stemmed from its ability to transcend the clan enmities that have bedevilled Somalia since the overthrow of former President Mohamed Siad Barre in 1991.
The UN estimates that about 30,000 people have been displaced during the fighting, and casualties have been high.