WASHINGTON — President Trump left open the possibility on Wednesday of relaxing economic sanctions against Iran before starting new nuclear negotiations, seeming to undercut his administration’s “maximum pressure” campaign against Tehran in favor of striking a diplomatic deal.

Hours earlier, President Hassan Rouhani of Iran said that the United States must lift its bruising sanctions before officials in Tehran would be ready to talk.

Mr. Trump stressed his view that Iran’s economy is suffering, and that the leadership in Tehran is eager for negotiations.

“I do believe they’d like to make a deal,” Mr. Trump told reporters at the White House. “If they do, that’s great; and if they don’t, that’s great too. But they have tremendous financial difficulty, and the sanctions are getting tougher and tougher.”

He shrugged when asked if he would consider easing the sanctions to secure a meeting with Iran.

“We’ll see what happens,” Mr. Trump said.

Though Mr. Trump has previously offered to talk to Iran’s leaders, his comments on Wednesday appeared to be the first time he has publicly left open the door to softening his administration’s “maximum pressure” campaign. The shift would have been stridently opposed by John R. Bolton, the White House national security adviser who was unceremoniously ousted on Tuesday.

For nearly a year, the Trump administration has threatened economic penalties against foreign governments and businesses seeking to invest in Iran, or to buy its oil and other goods. The isolation campaign has crippled Iran’s economy and frustrated countries, including China and India, that rely on its oil.

Other allies, particularly in Europe, were infuriated in May 2018 when Mr. Trump withdrew the United States from a nuclear accord that Iran struck with world powers during the Obama administration. They have sought to create a barter system with Tehran that would keep financial channels open but not violate the American sanctions, and President Emmanuel Macron of France has dangled the possibility of a $15 billion bailout to bring Iran back into compliance with the 2015 deal.

Under the administration’s “maximum pressure” campaign, the Treasury and State Departments have ramped up sanctions against Iran to force it back into negotiations. Brian H. Hook, the State Department envoy overseeing Iran issues, told reporters last week that sanctions were essential to financially starving the government in Tehran and, in turn, making it more difficult to fund Iranian-allied fighters in conflicts across the Middle East.

“We are maintaining the maximum-pressure campaign,” Treasury Secretary Steven Mnuchin told reporters at the White House on Tuesday.

In a telephone call with Mr. Macron, reported on Wednesday by Iran’s official Islamic Republic News Agency, Mr. Rouhani said that “if the sanctions remain in place, negotiations with the U.S. administration have no meaning.”

As he faces re-election next year, Mr. Trump has been searching for a diplomatic victory — not just with Iran, but also with North Korea and Afghanistan.

Secretary of State Mike Pompeo has repeatedly offered to open talks with Iranian officials, without setting any conditions for the negotiations, and has raised the possibility of a meeting at the annual global forum at the United Nations this month.

A similar effort in 2017 to set up a meeting between Mr. Trump and Mr. Rouhani at the United Nations collapsed.

President Barack Obama never managed to meet with Mr. Rouhani, even after the nuclear deal was signed.

The closest the two presidents came was a 2013 phone call that lasted 15 minutes and was arranged by Mr. Rouhani as he departed the United Nations General Assembly. Mr. Obama took the call at the White House; it was the first direct conversation between the leaders of the two countries since the 1979 Iranian Revolution that ousted the American-backed shah.

But Mr. Trump also made clear on Wednesday that he would not bend on his vow to block Iran’s efforts to escalate the country’s nuclear program, which had been largely shelved as a result of the 2015 agreement. “If they’re thinking about enrichment, they can forget about it,” Mr. Trump said. “Because it’s going to be very dangerous for them to enrich.”

Mr. Rouhani said over the weekend that Iran was preparing to restart its production of highly enriched uranium, the material needed to build a nuclear weapon. Doing so would most likely scuttle any hope of resurrecting the nuclear accord with world powers, as Mr. Macron has been trying to do.