"The U.S. efforts to impose its policies on others are expanding as a threat to all," Rouhani told the summit of the Shanghai Cooperation Organisation (SCO), a regional security grouping led by China and Russia where Iran has observer status.
"The recent example of such unilateralism and the defiance of the decisions of the international community by the U.S. government is its withdrawal from the JCPOA," he said, referring to the nuclear agreement by its official name, the Joint Comprehensive Plan of Action.
The 2015 agreement between Iran and world powers lifted international sanctions on Tehran. In return, Iran agreed to restrictions on its nuclear activities, increasing the time it would need to produce an atom bomb if it chose to do so.
Since U.S. President Donald Trump withdrew the United States last month, calling the agreement deeply flawed, European states have been scrambling to ensure Iran gets enough economic benefits to persuade it to stay in the deal.
Chinese President Xi Jinping, speaking after Rouhani, expressed "regret" that Washington had withdrawn from the nuclear deal.
"China is willing to work with Russia and other countries to preserve the JCPOA," Xi said.