Key US ally Israel, Iran's arch-enemy, has launched hundreds of strikes in Syria since the start of a civil war there in 2011, including against Iranian forces.
Iran, one of President Bashar al-Assad's main allies in the conflict, has always denied sending forces to fight in Syria, saying it only has military advisors there.
Under the latest deal, "we will strengthen Syria's air defence systems in order to improve military cooperation between the two countries," Iranian state TV quoted armed forces chief Major General Mohammad Bagheri as saying.
The deal will "further enhance our will... to confront pressures by America," he added.
Along with Moscow, Tehran has played a key role supporting Assad in the war that has ravaged the country and killed more than 380,000 people, displacing millions.
Israeli strikes have meanwhile targeted government troops, allied Iranian forces and fighters from the Iran-backed Lebanese Shiite militant group Hezbollah.
Syria was one of the few countries that helped Iran during the 1980-88 war with Iraq, and Tehran and Damascus signed a deal in 2006 sealing their military alliance.
State TV's website on Wednesday published a video of Bagheri and Syria's Defence Minister Ali Ayoub signing the latest agreement in Damascus.
It shows an Iranian military spokesman reading a joint statement saying the "comprehensive military-security agreement" aims to "confront increasing dangers (and) takfiri terrorism supported by international and regional powers".
Iranian officials use the term "takfiri" to refer to Sunni jihadists, including groups fighting in Syria.
'Strategic and firm'
Syrian state news agency SANA quoted Ayoub calling Syrian-Iranian ties "strategic and firm".
"Bilateral military and security cooperation is qualitative and ongoing... despite increasing pressure and the mounting severity of threats," he said.
Ayoub vowed to confront "any new challenges with more determination ... with the efforts of all the Syrian people and cooperation with friends and allies determined to confront terrorism in all its forms."
The joint statement Wednesday also demanded "the withdrawal of all foreign armed forces having entered Syria illegally".
Turkey and the US-led coalition against the Islamic State group have both sent troops to Syria, despite objections from Damascus.
The latest deal between Iran and Syria comes after the US in late June urged the UN Security Council to extend a ban on conventional arms sales to Tehran, set to expire in October.
The lifting of the embargo, agreed under the landmark 2015 Iran nuclear treaty, would allow the country to obtain battle tanks, combat aircraft, warships and missiles or missile systems.
The Trump administration, which pulled out of the 2015 accord in 2018, has warned it could employ a disputed legal move to restore wide UN sanctions on Iran if the Security Council does not prolong a ban.
Washington's European allies have voiced support for extending the embargo but also oppose new sanctions, saying the bigger issue is Iran's nuclear program.
The nuclear accord has been on life-support since the US withdrew from it and reimposed crippling unilateral sanctions on Iran.
A UN embargo on materials, goods, equipment and technology that Iran could use for its ballistic missile programme is to remain in place until 2023.
The European Union has said it will continue its own embargo against Iran after the UN limitation is lifted.