But the evident dissonance between the president and his senior national security advisers has taken on greater consequence in the cases of Iran and North Korea, which are potentially questions of war or peace.

Amid the simmering North Korean crisis, Secretary of State Rex W. Tillerson told reporters in Beijing over the weekend that he was keeping “a couple, three channels open to Pyongyang” to defuse the situation. The next morning, he was slapped down by Mr. Trump, who read newspaper accounts of that conversation and tweeted “save your energy Rex,” complaining that Mr. Tillerson was “wasting his time trying to negotiate with Little Rocket Man,” the president’s derisive nickname for Kim Jong-un, the North Korean leader.

White House officials said Mr. Trump was angry that his secretary of state was suggesting it was time to talk with North Korea, when official administration policy is that the North must earn the right — by halting missile and nuclear tests for an unspecified period of time.

It was hardly the first time that Mr. Tillerson, who is widely reported to be frustrated in the job, has publicly split with the president. In August, he conceded that he had argued in favor of keeping the Iran deal, saying he had “differences of views” from the president. At the same time, he acknowledged that Iran continued to support terrorism and was failing to comply with what he called “the spirit” of the agreement.

At the meeting with reporters in the American ambassador’s residence in Beijing, Mr. Tillerson hinted he was pressing Mr. Trump to certify to Congress once again that Iran is in compliance with the agreement despite Mr. Trump’s declaration in August that he would have declared the country “noncompliant 180 days ago.”

Mr. Trump must make that decision anew by Oct. 15. But his choice is not necessarily the final word on the deal. Even if he decertifies the agreement, Congress could hold back on restoring the economic sanctions that the United States agreed to ease in exchange for Iran halting its nuclear weapons program. If Congress did not act, the deal would be preserved.

“I don’t want to suggest to you that we’re not going to stick with the Iranian deal,” Mr. Tillerson said. “The president will have to make that decision; ultimately, it’s what he wants to do.”