Speaking at a news conference with Iraqi Foreign Minister Mohammed al-Hakim during a visit to Baghdad, Mogherini said the bloc appreciated and supported Iraq's policy of pursuing good relations with all its neighbors and warned against "dangerous adventures" in the region.
"The minister and I talked at length about the increasing tensions around Iraq and the need first and foremost to avoid escalation, avoid any miscalculation, that could lead to very dangerous consequences; first and foremost for Iraq but also beyond that," she said.
Mogherini's trip comes at a time of heightened Iranian-U.S. tensions. The U.S. blames Iran for several recent attacks on oil tankers and the two foes came close to direct military conflict last month when Iran shot down a U.S. drone and President Donald Trump ordered retaliatory air strikes, only to call them off minutes before impact.
Trump withdrew the United States last year from a 2015 deal between Iran and world powers to curb its nuclear program. Washington has sharply tightened sanctions on Iran, which has responded by stepping up uranium enrichment beyond limits set by the deal.
European countries do not directly support the U.S. sanctions, but have been unable to come up with ways to allow Iran to avert them.
The tensions have placed Baghdad, whose two biggest allies are Washington and neighbor Tehran, in an uncomfortable position and directly threaten its security.
Iraq relies on the U.S. for security assistance and imports energy and vital goods from Iran, with whom its Shi'ite majority shares religious ties. Both helped it defeat Islamic State militants that overran a third of its territory at one point.
A military conflict between them would almost certainly spill over into Iraq which houses both U.S. troops and influential Iran-allied Shi'ite militias.
"We also affirmed to Ms. Mogherini that Iraq should not become a battleground for this conflict, but rather it should play a role in helping solve this crisis alongside other Arab countries especially Kuwait and Oman," Hakim said, adding that a conflict would also complicate counter-terrorism efforts.
"The unilateral cancellation of the nuclear agreement caused a crisis that could have been avoided through negotiations," he said referring to Trump's withdrawal from the deal, but added the EU could play an important role in de-escalating tensions.
The EU supports Iraq's proposal to hold a regional conference between Iran and U.S.-allied Sunni Gulf states like Saudi Arabia and the United Arab Emirates, said Mogherini, who also met Iraqi Prime Minister Adel Abdul Mahdi and President Barham Salih during her trip."The European experience is that even in the most difficult times it is always better to sit and talk rather than to explore avenues of the unknown that can be dangerous for everybody," she said.