Presidents also discussed in the meeting.
Presidents of Iran and Russian Federation called for continuing commitment to the 2015 worldwide nuclear agreement between Tehran and world powers.
The meeting came hours before a Tehran-hosted summit between presidents of Iran, Russia and Azerbaijan to discuss trilateral and regional issues, including the Syrian crisis.
Russian President Vladimir Putin arrived in Tehran to meet with the leaders of Iran and Azerbaijan, Interfax reports.
"We are managing to coordinate our positions on the Syrian issue", Putin said.
"Unilateral dismantling of the nuclear deal under any excuse is not acceptable", Putin said.More news: Dolphins send Ajayi to Eagles for draft pick
The two generals met in Tehran as part of efforts for expansion of military cooperation between the two countries. "The joint cooperation and consultations are very important in the final stages too".
"We oppose any unilateral change in the multilateral nuclear deal", Putin told Khamenei, Iranian state TV reported. Details of that meeting were not immediately publicized. It's his third visit to Iran after previously making trips in November 2015 and in 2007.
Earlier in the day, Putin sat down for talks with his Iranian counterpart, Hassan Rouhani. The project is estimated to cost some $8.5 billion, with each reactor producing 1,057 megawatts of electricity.
US President Donald Trump has refused to confirm whether his government will comply with the agreement and has threatened a harder line on Iran, which the US suspects has been seeking to build a nuclear bomb.
The European Union officials and the other parties to the deal (Russia, Great Britain, China, France, and Germany) have all urged Trump not to pull the United States out, as that could endanger the entire deal.
Rouhani also said Tehran will welcome Russian investors and private firms willing to undertake development and other projects in Iran.