Somali insurgents launched a rocket attack on a military base in the capital, Mogadishu, late on Tuesday.
Eyewitnesses told the BBC two civilians were killed in the hour-long battle.
A military spokesman said about 20 insurgents armed with rocket-propelled grenades and heavy machine guns were fought off with anti-aircraft guns.
Last week the Somali Islamists and opposition formed a new alliance to remove Ethiopian troops helping the transitional government from Somalia.
Residents said more than 50 insurgents were involved in the attack, which involved the first serious fighting in Mogadishu since the opposition alliance was formed.
Ethiopian as well as Somali government troops fought off the attack.
Meanwhile, Shabelle Radio which came under attack from government soldiers on Tuesday, remained off the air following a renewed threat.
Shabelle director, Jafar Kukay, said: "The same troops who attacked us, threatened that they would use greater force if they hear us on air and that really forced us to shut down the station".
Government troops had previously raided Shabelle Radio and detained 18 journalists after a grenade was thrown.