The Trump administration has called the omission of ballistic missiles a central flaw of the agreement, which Mr. Trump may try to revisit — or scrap altogether, as he has threatened in the past.

At the annual United Nations gathering in New York this week, Mr. Trump called the nuclear deal “an embarrassment to the United States,” and Mr. Rouhani retorted, in his own address: “It will be a great pity if this agreement were to be destroyed by ‘rogue’ newcomers to the world of politics.”

Upon his return from New York, Mr. Rouhani strongly defended Iran’s right to self-defense.

“We will increase our military power as a deterrent,” he said. “We will strengthen our missile capabilities. We will not seek anyone’s permission to defend our land. Not only will we fortify our missiles, but our ground, navy and air forces will always be supported by the people.”

The unveiling of the new missile, called the Khoramshahr, comes two months after Iran launched a missile into space, prompting a new round of sanctions and criticism from the United States.

“Rouhani is playing hardball,” said Sanam Vakil, an Iran scholar at Chatham House, a think tank in London, and at the Paul H. Nitze School of Advanced International Studies at Johns Hopkins University. “By promising to step up Iran’s ballistic missile program, Rouhani seeks to gain support from Iranian hard-liners who have long been critical of the nuclear deal, and who have repeatedly accused him of being soft in international relations. Moreover, hard-liners, such as Iran’s supreme leader, believe compromise with the United States is a futile exercise.”