China and Iran signed a 25-year cooperation agreement on Saturday to strengthen their long-standing economic and political alliance.
Both countries are subject to US sanctions.
“Relations between the two countries have now reached the level of strategic partnership and China seeks to comprehensively improve relations with Iran," Chinese Foreign Minister Wang Yi was quoted by Iran's state media as telling his Iranian counterpart Mohammad Javad Zarif.
“Our relations with Iran will not be affected by the current situation, but will be permanent and strategic," Wang said ahead of the televised signing ceremony.
“Iran decides independently on its relations with other countries and is not like some countries that change their position with one phone call."
The accord brings Iran into China's Belt and Road Initiative, a multi-trillion-dollar infrastructure scheme intended to stretch from East Asia to Europe.
Rouhani expressed appreciation of Beijing's support for Iran's position on its 2015 nuclear deal with world powers.
“Cooperation between the two countries is very important for the implementation of the nuclear accord and the fulfilment of obligations by European countries," Rouhani said, according to his official website.