The mayor of Amerli and army officers said troops backed by militias defeated fighters from the Islamic State (IS) to the east of the town. Fighting continued to the north of Amerli in several villages.
"Security forces and militia fighters are inside Amerli now after breaking the siege and that will definitely relieve the suffering of residents," said Adel al-Bayati, mayor of Amerli.
It was hailed as a huge strategic victory for the Iraqi security forces and the militia fighters who joined them after a summer that saw the Islamic State lead other Sunni armed groups in seizing almost one-third of the country's territory.
"Amerli's battle is a golden victory registered by the Iraqi security forces who are still fighting the terrorist groups in north and south areas of Amerli," said military spokesman Qassim al-Attta.
Atta described Amerli as a launching pad to retake the northern province of Salahuddin, including its capital, which was captured by IS in June.
"The next step will be holding the ground tightly and liberating all the areas which link Amerli to Salahuddin," Atta said on state television. "Our forces will gather in thousands in Amerli to march towards Tikrit."
While Kurdish fighters, backed by US air strikes, had beat back the Islamic State after losing terrain in August, the collection of Shi'ite security forces and militias had yet to score a significant military win.
The advance of the Iraqi forces in Amerli comes after the U.S. military carried out air strikes overnight on IS militant positions near the town and airdropped humanitarian supplies to the trapped residents there. More aid was dropped from British, French and Australian planes.
The Pentagon said the warplanes hit three Humvee patrol vehicles, a tank and an armed vehicle held by militants in addition to a checkpoint controlled by the group, according to the military's Central Command, which runs U.S. operations in the Middle East.
The air strikes created the strange scenario of U.S. forces assisting fighters, some of whom once combatted U.S. soldiers.
One Kurdish fighter on a base north of Amerli described the American role as critical in ending the siege.
"It would have been absolutely impossible without the American planes," the Kurdish peshmerga fighter said. "The strikes prevented the Islamic State from moving freely and targeted them with 100 percent accuracy."
Residents of Amerli expressed relief.
"I can see the tanks of the Iraqi army patrolling Amerli's streets now. I'm very happy we got rid of the Islamic State terrorists who were threatening to slaughter us," said Amir Ismael, an Amerli resident, by phone.
Armed residents had managed to fend off attacks by IS fighters, who encircled the town and regarded its majority Shi'ite Turkmen population as apostates. More than 15,000 people had remained trapped inside Amerli.
North of Amerli, Shiite militia and Kurdish peshmerga fighters were deployed. The armed men were a reminder of how militia fighters have gained in popularity since the beginning of June when IS launched its blitz across northern Iraq and the security forces collapsed.
"Our goal is all the same to fight IS and repel terrorism," said a fighter from the Peace Brigades, an offshoot of Cleric Muqtada Sadr's Mahdi Army militia.