Iran warned on Sunday that "any foreign military intervention in Iraq" would only complicate the crisis, after the United States said it was deploying a warship in the Gulf.
"Iraq has the capacity and necessary preparations for the fight against terrorism and extremism," foreign ministry spokesman Marzieh Afkham was quoted as saying by the ISNA news agency.
"Any action that complicates the situation in Iraq is not in the interests of the country nor of the region," Afkham said, adding: "The people and government of Iraq will be able to neutralise this conspiracy."
Iraq is battling an offensive by Sunni militants who advanced to within 80 kilometres (50 miles) of Baghdad's city limits after seizing a swathe of the country's north.
Responding to the crisis, the Pentagon said on Saturday the United States had ordered an aircraft carrier, the USS George H.W. Bush, into the Gulf.
Afkham's comments come a day after President Hassan Rouhani said he believed the Iraqis have the capacity to "repel terrorism" and that Iran had not been asked for help by its neighbour.
But in surprise comments, he added that Iran may consider cooperating with its arch-foe the United States to fight the Sunni extremist militants in Iraq.
"If we see that the United States takes action against terrorist groups in Iraq, then one can think about it," he said, despite the lack of diplomatic relations between Tehran and Washington for more than three decades.
Signup to our newsletter and follow us on Facebook and Twitter!
"We have said that all countries must unite in combating terrorism. But right now regarding Iraq... we have not seen the Americans taking a decision," Rouhani added.
However, National Supreme Security Council chief Ali Shamkhani dismissed any US-Iran cooperation over Iraq.
"That is part of a psychological war, and is totally unreal," Shamkhani said, denouncing "information published in the West's media".
"As we have already said, if there is an official Iraqi request we will be ready to study it under the framework of international rules, and this concerns no other country," added Shamkhani, a Rouhani appointee.
Shamkhani criticised US policy in the region, saying it had "encouraged the creation of terrorist groups such as ISIL", the Islamic State of Iraq and the Levant.
Quoted by the official IRNA news agency, he also denounced the use of "brutal extremists to implement the will of the United States against that of the people in Iraq and Syria".
The deployment of the US aircraft carrier group was ordered by Defence Secretary Chuck Hagel and comes amid calls for air strikes to blunt the insurgents' lightning offensive that caught Iraq's security forces on the hop, with many soldiers throwing away their uniforms and fleeing.
However, Iraqi troops launched a counter-offensive on Saturday, recapturing two towns north of Baghdad, and thousands of volunteers answered a call to arms from top Shiite cleric Grand Ayatollah Ali al-Sistani.