Mocimboa da Praia: Mozambique battles for port seized by IS
The city is near the site of natural gas projects worth $60bn (£46bn).
The military says there is ongoing action to "neutralise" the Islamic State group-linked militants, who have been using local people as shields.
It follows days of fighting for the port in the country's gas-rich north.
Dozens of soldiers are reported to have been killed, and a patrol boat sunk, while the army says it has killed about 60 militants.
BBC Africa correspondent Andrew Harding says the loss of the city was a serious blow to Mozambique's military, who are struggling to contain a growing rebellion in the gas-rich province of Cabo Delgado.
Mocimboa da Praia is used for cargo deliveries to the offshore projects about 60km (40 miles) away, which are being developed by oil giants including Total.
The militants have briefly taken a number of northern towns in recent months, displacing tens of thousands of people. This was one of several attacks on Mocimboa da Praia this year.
Tanzania has also said it will launch an offensive against the jihadists in forests along the border with Mozambique.
Mozambique's defence forces have insisted the battle for Mocimboa da Praia is not over.
But the events of the past week have exposed both the weaknesses of the army, and the growing strength and sophistication of an Islamist rebellion that is now emerging from the shadows to become a major regional threat.
Multiple reports suggest that government troops had been forced to make a humiliating retreat from the strategic port, having run out of ammunition.
In recent months, the rebels have briefly overrun several towns in the region, in part, it seems, for propaganda and recruitment purposes.
Some of the world's biggest energy companies are now seeking extra protection as they prepare to tap into Mozambique's massive off-shore gas fields.
The government has sought some help from foreign security contractors. But so far, it appears reluctant to reach out to neighbouring countries for direct military assistance.
Attacks began in 2017 in the northern province of Cabo Delgado, but escalated this year after the group responsible, Ahlu Sunnah Wa-Jama, pledged allegiance to IS.
Earlier this week IS claimed, though its own media channels, that it had taken over two military bases near Mocimboa da Praia, killed Mozambique soldiers and captured weaponry, including machine guns and rocket-propelled grenades.