Elite troops, backed by helicopters, launched a massive-scale operation and drove militants from the radical Islamic State in Iraq and the Levant (ISIL) out of the city.
"The insurgents fled to edges of Samara after suffering hard strikes and heavy losses," one security official told dpa on condition of anonymity.
"The Iraqi troops have liberated the city. No gunmen can be seen."
Earlier Thursday, militants from ISIL, a splinter group of al-Qaeda, had seized control of six districts in Samara.
The heavily armed militant group had entered the city from several directions, using bulldozers to destroy a number of security checkpoints, witnesses said.
Samara, 118 kilometres north of Baghdad, is largely populated by Iraq's Sunni Muslims but is also home to one of Shiite Islam's most important shrines, the Golden Mosque that holds the tombs of two Shiite imams.
ISIL militants, have controlled parts of the western province of al-Anbar since January, fighting off security forces and militiamen loyal to government.
Over the past year, Iraq has seen near-daily attacks believed to be carried out by extremist militants against security forces and people.
NJF/NJF