The agreement marks a considerable advance in relations between the two countries that fought a bitter 1980-1988 war and comes despite repeated US accusations that Iran has undermined security in Iraq since the fall of Saddam Hussein in 2003.
"It's a new chapter in our relations with Iraq. We will start wide defence cooperation," Iranian Defence Minister Admiral Ali Shamkhani told a joint news conference with visiting Iraqi counterpart Sadoun al-Dulaimi.
"We're going to form some committees which will be involved in mine clearance, identifying those missing from the war and also ... to help train, rebuild and modernise the Iraqi army," Shamkhani added.
Iran last year offered to train Iraqi border guards, but Baghdad declined the offer.
US and Iraqi officials have often accused Iran of stirring up instability in Iraq. Tehran denies meddling in Iraq or helping, arming or letting foreign fighters cross its borders.
Asked about possible US opposition to Iran-Iraq military cooperation, Shamkhani said: "No one can prevent us from reaching an agreement."
"Nobody can dictate to Iraq its relations with other countries"
Iraqi defence minister
Iraq's al-Dulaimi echoed Shamkhani's comments.
"Nobody can dictate to Iraq its relations with other countries," he said.