President Trump said he would be willing to meet with his Iranian counterpart without first demanding diplomatic concessions, the latest public overture involving nations he has also condemned and called a threat to American safety and economic security.

The remark by Mr. Trump, in response to a question at a White House news conference Monday, was another example of his off-the-cuff style of diplomacy. It came just a week after he traded threats with the Iranian president, Hassan Rouhani. Top White House advisers said there had been no internal planning for a potential meeting with the Iranian president. Aides said they were “working a response” to Mr. Trump’s remarks.

In a televised interview later, Secretary of State Mike Pompeo listed preconditions for such a meeting, in contrast to Mr. Trump’s offer.

The president’s expressed openness to meet with Mr. Rouhani came less than three months after he withdrew the U.S. from the international accord aimed at curbing Iran’s nuclear ambitions. As a candidate in 2016, Mr. Trump criticized Iran as the “biggest sponsor of terrorism around the world.”

Mr. Trump’s remarks evoked his approach to North Korean leader Kim Jong Un, with whom he met in June, just 10 months after threatening Pyongyang with “fire and fury like world has never seen.”