"Everybody knows what the Persian Gulf means to Iran, and what policy Iran pursues about its national interests and security," Saeed Khatibzadeh was quoted as saying by the Tasnim news agency.
The spokesman added that Israel should be "aware of the risks of crossing Iran’s red lines."
Israeli state media said last week that a Dolphin-class submarine had crossed the Suez Canal visibly above water in mid-December as an overt threat to Iran.
Iran has threatened Israel with revenge for what it sees as an Israeli operation to assassinate a leading nuclear scientist. Mohsen Fakhrizadeh was shot at with a satellite-controlled machine gun near Tehran in November.