In the treaty, Russia and Iran committed to consult and cooperate in combating military and security threats, and to participate in joint military exercises both on their territories and abroad.
They also agreed not to allow their territories to be used for actions that threaten the other side.
Iranian President Pezeshkiyan said that the signing of the agreement means that Russia and Iran are entering a new chapter in relations.
Trade between the two countries can be significantly increased by expanding cooperation in the energy sector.
During a joint press conference with his Iranian counterpart, Russian President Vladimir Putin said that his country is considering the possibility of building new nuclear power plants in Iran.
Moscow is also seeking to sell some of its excess gas to Tehran. Since the beginning of the war in Ukraine, the EU has significantly reduced gas imports from Russia, which has pushed Moscow to seek new customers.
The planned gas pipeline from Russia to Iran, about which the countries are negotiating, if implemented, will be laid through the territory of Azerbaijan, the Interfax agency reported on Friday with reference to the Minister of Energy of Russia Sergey Tsivilyov.
Russia could supply Iran with up to 55 billion cubic meters of gas per year, Putin said.