DUBAI—Iran’s President Hassan Rouhani said Tuesday that the Islamic Republic’s armed forces were the Middle East’s best defense against the spread of terrorist groups including Islamic State.

“Today we tell the world that the biggest antiterrorism force is the armed forces of the Islamic Republic,” Mr. Rouhani said in Tehran during a rally to commemorate the anniversary of the start of the Iran-Iraq War in 1980, according to the official Islamic Republic News Agency.

Iran...