Sunni militants led by ISIS – the Islamic State in Iraq and the Levant – captured key cities including Mosul and Tikrit last week, but some towns were retaken.
Fighting in Tal Afar began on Sunday, with mortar shelling of some districts as militants tried to enter the city.
The Iraqi military setback came as the US said it was considering direct talks with Iran on Iraq.
President Barack Obama is weighing up options on action to take in Iraq.
The USS George HW Bush aircraft carrier is already being deployed to the Gulf, accompanied by two more warships. But Washington says no US troops will be deployed on the ground.
Iranian President Hassan Rouhani has said he will consider co-operation if the US takes action in Iraq.
Tal Afar is a mainly Shia and ethnic Turkmen city, and seen as a buffer against militant-controlled territory in Iraq and Syria.
The Iraqi government claims to have “regained the initiative” against an offensive by Sunni rebels.
Earlier, Iraqi army spokesman Lt. Gen. Qasim Ata said the military had scored successes against the militants in several areas, killing 279 of them. The figure could not be independently verified.
Local TV stations say government helicopters carried out a raid during the night on a military base near Mosul, which was captured by the militants last week.
Government forces were reported to be building up in the city of Samarra, north of Baghdad, ready for a counter-offensive on Tikrit.
The United States has begun evacuating some diplomatic staff from Baghdad, moving them to Kurdish-controlled territory in the north-east and to Basra in the south.
The US has also announced it is increasing security at its embassy in Baghdad and relocating some staff to safer areas.
oCZVkX1qPkEImage source: Wikimedia Commons President-elect Donald Trump celebrated his election victory at the Ultimate Fighting…
Millions of voters across the US chose to return Donald Trump to the White House…
Donald Trump declares victory in the US election as he addresses jubilant supporters in Florida.…
Stocks around the world are rising as Donald Trump appears to be on the cusp…
Donald Trump has won Pennsylvania, North Carolina and Georgia and taken a lead over Kamala…
Quincy Jones, the celebrated musician and producer who worked with Michael Jackson, Frank Sinatra, Ray…