Russian defence minister Sergei Shoigu on Tuesday signed a military cooperation deal with Iran that his Iranian counterpart touted as a joint response to US "interference".
Shoigu is the most senior Russian military official to visit Tehran since 2002, according to Iranian media, and the agreement comes with both countries facing western sanctions.
The deal provides for joint exercises and military training, as well as "cooperation in peacekeeping, maintaining regional and international security and stability, and fighting against separatism and extremism," the Iranian defence ministry website said.
Defence minister Hossein Dehqan told state television that Iran and Russia had a "shared analysis of US global strategy, its interference in regional and international affairs and the need to cooperate in the struggle against the interference of foreign forces in the region."
Russia has long been Iran's principal foreign arms supplier but their ties took a major hit in 2010 when Moscow cancelled a contract to deliver advanced S-300 ground to air missiles, citing UN sanctions imposed over Tehran's nuclear programme.
Iran demanded $4 billion in compensation for the cancellation of the $800 million order.
"The two countries have also decided to settle the S-300s problem," the Iranian defence ministry said, without elaborating.
As Russia has been hit by Western sanctions over its involvement in the conflict in Ukraine, it has stepped up its economic ties with Iran in the past year.
The two governments are also both allies of Syrian President Bashar al-Assad in his nearly four-year-old conflict with Western-backed rebels.