The clashes took place in Jurf al-Sakhr, a small Euphrates River town on a road linking Sunni insurgents strongholds in the west to Shiite holy cities south of Baghdad.
"Seventeen soldiers were killed and three wounded during clashes with insurgents in Jurf al-Sakhr that lasted two hours this morning," an army lieutenant told AFP.
An army medic confirmed the death toll, with both sources saying 23 jihadists from the Islamic State were also killed.
IS launched a sweeping offensive in northern Iraq on June 9, conquering the second city Mosul and large parts of the country's Sunni heartland.
More From This Section
Jurf al-Sakhr lies on the edge of what became known during a previous wave of sectarian bloodshed eight years ago as the "triangle of death."
The army and allied Shiite militia, such as Asaib Ahl al-Haq, take up positions in the town during the day but often pull back at night, which allows insurgents to plant roadside bombs.
Another 17 people, including some IS fighters, were killed in a government air raid on Jurf al-Sakhr Monday.
In Baghdad, a car bomb exploded on a busy street of the large Shiite neighbourhood of Sadr City, killing at least nine and wounding 21, according to a police colonel and medical sources.
Three blasts near the Baghdad's central Kholani Square also went off near a Shiite mosque, killing five and wounding 16, according to the same sources.
Figures compiled by the health, interior and defence ministries showed that 1,401 civilians, 185 soldiers and 83 policemen were killed in July.
The United Nations representation in Iraq provided a higher figure, saying at least 1,737 people were killed.