Government forces had full control of Mingora, though they were still meeting pockets of resistance from fighters on the outskirts of the town, Maj. Gen. Athar Abbas told The Associated Press.
The military launched a major offensive one month ago in the Swat Valley and neighboring areas to oust Taliban militants who were extending their control over the northwestern region, near the border with Afghanistan.
The campaign is strongly backed by Washington and the government's other Western allies, who see it as a test of the government's resolve to fight extremism in the Pakistan.
"As far as Mingora city, security forces have taken over," Abbas said. "There are still pockets of resistance. They are on the periphery of Mingora city."
Government troops have been advancing steadily into the Swat region, bombarding towns from the air and fighting house-to-house with Taliban gunmen.
The fighting has caused more than 2 million people to flee the region, raising fears of a humanitarian crisis. More than 160,000 people are taking refuge in sweltering refugee camps south of the battle zone, while the rest are staying with relatives or relying on goodwill from local residents.
Widespread domestic support for the campaign could sour if the government is perceived to have failed the refugees or if a high number of civilian casualties is revealed.
The Taliban has warned it will launch terrorist strikes in Pakistani cities in retaliation for the campaign, and claimed responsibility for a gun and suicide bomb attack on Wednesday in the eastern city of Lahore that killed at least 30 people. A day later, three suicide bombings killed at least 14 people in two cities in the northwest.