"If Israel takes such a stupid step and attacks, the answer of Iran and its Revolutionary Guard will be rapid, firm and destructive and it will be given in a few seconds," a spokesman for the Iranian foreign ministry said on Sunday.
Addressing a news conference, Mohammad Ali Hosseini also said that Iran was pressing ahead with plans to expand its programme to enrich uranium, which the US and Israel say could be used to make nuclear warheads, despite Tehran's denials.
Israel bombed Iraq's Osirak nuclear reactor in 1981 to prevent former president Saddam Hussein from making atomic weapons, and some analysts are speculating that Israel could consider similar action against Iran if it felt threatened.
Mahmoud Ahmadinejad, the Iranian president, has said Israel should be "wiped off the map" but has also said that Iran is not a threat.
Experts say knocking-out Iran's nuclear facilities will be far more difficult than it was in Iraq, partly because Iranian sites are spread out and heavily protected.
Israeli officials have said that they want the international community, which has been pushing Iran to halt its atomic work, to resolve the dispute through diplomatic means.
"If Israel takes such a stupid step and attacks, the answer of Iran and its Revolutionary Guards will be rapid, firm and destructive and it will be given in a few seconds"
Mohammad Ali Hosseini, Iranian foreign ministry spokesman
But so far Iran has not responded to UN demands to halt uranium enrichment, a part of Iran's programme which some Western politicians argue could be used to make fuel for nuclear power stations or material for warheads.
Asked if Iran was continuing with its plans to build by March 3,000 centrifuges, used to enrich uranium, Hosseini said: "Iran is trying to do so under the supervision of the IAEA."
The UN atomic watchdog, the International Atomic Energy Agency, carries out routine checks of Iran's nuclear facilities.
Iran recently launched a new chain of 164 centrifuges, called a cascade. It now has two such chains working, but such a small number would take years to produce enough material for a single warhead. But Iran says it plans to build thousands.
Iran, the world's fourth largest oil exporter, insists it only wants to master the nuclear fuel cycle to make electricity.