"These men were terrorists in police uniform," the spokesman told reporters on Monday.
He said the attackers arrived at the school in two civilian cars, led the teachers and the school driver to a part of the school where no children were present, and shot them.
Sectarian killings are rife in Iraq, but schoolteachers have rarely been targets for attacks.
Fighters using roadside bombs killed three US soldiers in Iraq on Monday, and at least 10 Iraqis died in a bomb attack that targeted police and government employees in the capital, officials said.
The deaths came as US and Iraqi officials tried to reach out to Iraqi citizens with a goodwill gesture on Monday by freeing 500 detainees from the notorious Abu Ghraib prison ahead of the Muslim holy month of Ramadan.
The roadside bomb attacks killed two American soldiers in western Baghdad early on Monday, and another one about 80km southeast of the capital, the military said.
The deaths raised to 1917 the number of US soldiers who have died since the beginning of the Iraq war in March 2003, according to an Associated Press count.
In renewed violence in Baghdad, a car bomber attacked a police checkpoint guarding Iraq's Oil Ministry, Irrigation Ministry and national police academy, also hitting a nearby private bus carrying 24 Oil Ministry employees to work, said police Captain Nabil Abdel Qadir.
The blast killed at least seven police officers and three people on the bus, Qadir said. It wounded 36 Iraqis, 14 of them police officers and 22 of them passengers, he added.
"These men were terrorists in police uniform"
"The insurgents are targeting Iraqi government employees and worshippers in mosques," Oil Minister Ibrahim Bahr al-Uloum said after rushing to the site.
"These savage acts won't undermine the forthcoming people's referendum on the new Iraqi constitution."
The attacks raised this week's toll from stepped-up violence by fighters in and around the capital to 43 Iraqis and three Americans.
After a brief ceremony at Abu Ghraib prison on the outskirts of Baghdad, about 500 detainees left on public buses.
They were the first of 1000 due to be freed before Ramadan begins next week, the US military said.
Another 1000 were released from the prison last month.
The military said they were not guilty of violent crimes such as bombing, torture, kidnapping or murder.
Arab governments often pardon non-violent offenders during Ramadan, which this year is expected to begin on 4 or 5 October.
It was the first time US and Iraqi officials made such Ramadan releases at Abu Ghraib.
The move appeared to be part of a government effort to persuade citizens to vote in the 15 October national referendum on Iraq's draft constitution, particularly the Sunni minority.
Approval of the constitution would be an important step in the country's democratic transformation. But many Sunni leaders and fighters are calling for a boycott or a no vote in the referendum.
They say the document would leave minority Sunnis with far less power than the country's Kurds and majority Shia.
If two-thirds of voters in any three of Iraq's 18 provinces reject the charter, a new government must be formed and the process of writing a constitution starts over.
Abu Ghraib prison, built by Saddam Hussein's government in the 1970s, was retained as a major detention centre by the US after the invasion of Iraq in 2003.
It gained international notoriety after a number of US military personnel were charged with humiliating and assaulting detainees at the facility.
On Sunday, fighters loyal to Shia cleric Muqtada al-Sadr ambushed an Iraqi patrol in an eastern Baghdad area, and US forces joined a 90-minute gun battle, killing as many as eight of the attackers in the first significant violence in the neighbourhood in nearly a year.
Al-Sadr's militia, the al-Mahdi Army, was a stubborn problem for US forces until a truce was negotiated about a year ago that allowed some US troops to pull out of Sadr City to join the November assault on the fighter stronghold of Falluja, west of the capital.
Al-Sadr's men were involved in a
shootout with US troops
Before the truce, al-Sadr's forces had led unsuccessful but bloody uprisings against coalition forces in Kut and the holy cities of Najaf and Karbala, south of Baghdad.
With the referendum on Iraq's new constitution less than three weeks away, violence in the poor Shia district could deepen opposition among al-Sadr's supporters, who are bucking mainstream Shia support for the constitution.
Shia unity has been seen as critical for passage of the basic law. A statement from al-Sadr's office accused US forces of
trying to draw them into a battle "aimed at destroying Iraqi towns, particularly those in pro-Sadr areas and ... to prevent al-Sadr followers from voting" in the referendum.
Elsewhere in Baghdad on Sunday, armed men pulled off a daring armoured car robbery, killing two guards and escaping with $850,000.
South of the capital, two separate bicycle bombings in town markets killed at least seven people and wounded dozens.
In Samarra, 97km north of Baghdad, three mortar shells landed in a residential district. One shell hit a house, killing seven members of one family, including children, according to police Captain Laith Muhammed.
A US soldier also died on Sunday and two others were injured when their vehicle rolled over while on patrol near the Jordanian border, the US military said.