At the State Department, where some diplomats quietly applauded Mr. Trump’s gamble, there was a fear that more hawkish aides in the White House might throw up further hurdles to the meeting. The White House, they said, has invested more in sanctions and military options than in diplomacy. Officials there have in the past expressed frustration about what they viewed as the Pentagon’s reluctance to provide options for a military strike on the North.

With all the potential traps and internal misgivings, some officials said they believed the chances of a meeting between the two leaders actually happening were less than 50 percent.

Mr. Trump’s decision stunned allies and his own advisers, not least Secretary of State Rex W. Tillerson, who was caught unaware while traveling in Africa when the president accepted Mr. Kim’s invitation.

Mr. Tillerson’s lack of involvement in the announcement underscored how marginalized the State Department has become in North Korea policy. The department’s chief negotiator on the North, Joseph Yun, resigned from the Foreign Service last week.

Other State Department officials insisted that Mr. Tillerson had not been singled out; Mr. Trump blindsided all of his advisers. And the secretary, speaking to reporters in Djibouti, argued that Mr. Trump’s decision was not the bolt from the blue that it seemed.

“This is something that he’s had on his mind for quite some time, so it was not a surprise in any way,” Mr. Tillerson said. “He’s expressed it openly before about his willingness to meet with Kim Jong-un.”

Ms. Sanders said the president was in a “great mood” after two momentous days in which he had announced sweeping tariffs on steel and aluminum — fulfilling a cherished campaign promise — and had scrambled the equation on his most pressing foreign policy challenge.