Mr. Trump’s unhappiness with Mr. Tillerson, who once called him a “moron,” was well known, and the possibility of his replacement by the C.I.A. director, Mike Pompeo, was floated last autumn. Even so, the abruptness of the dismissal — hours after Mr. Tillerson returned from a tour of Africa and on the brink of awaited talks between President Trump and the leader of North Korea — stunned foreign policy experts.

That the news of Mr. Tillerson’s dismissal was announced by Mr. Trump on his Twitter account only contributed to the picture of an administration that has abandoned conventional decorum in favor a reality television show-style of freewheeling decision-making. The dismissal also raised fears that low morale at the State Department, hit by an exodus of diplomats, would plunge further.

“Tillerson loathed by State Dept diplomats, but balanced & sensible in most areas of foreign policy,” Ian Bremmer, president of the Eurasia Group, a political risk consultancy, said in a Twitter message. “Pompeo dramatically more hawkish on N Korea and Iran. Challenging day for the planet.”

Human rights advocates, while never enamored with Mr. Tillerson, also expressed alarm at Mr. Pompeo’s elevation. They were even more alarmed that Mr. Pompeo’s deputy at the C.I.A., Gina Haspel, had been named to replace him, given her role in coercive interrogations of terrorism suspects in the years after the Sept. 11 attacks.

The American Civil Liberties Union called Ms. Haspel the “central figure in one of the most illegal and shameful chapters in modern American history.”

Haspel was up to her eyeballs in torture, both in running a secret torture prison in Thailand and carrying out an order to cover up torture crimes.

One man held at the secret prison she ran was waterboarded 83 times, slammed against walls, sleep deprived, and locked in a box.

Vincent Warren, the executive director of the Center for Constitutional Rights, said in a statement that “Gina Haspel should be prosecuted, not promoted.”

A conspicuous exception to the surprise was the reaction of the United States ambassador to the United Nations, Nikki R. Haley, whose antipathy for Mr. Tillerson had been an open secret. Foreign Policy magazine reported last week that she had not even hung the official portrait of Mr. Tillerson in the lobby of the United States Mission to the United Nations.

Without mentioning Mr. Tillerson by name, she posted an enthusiastic message on Twitter moments after Mr. Trump’s announcement:

Congratulations to my friend and soon to be Secretary of State Mike Pompeo! Great decision by the President.

There was no immediate official reaction in Asia, partly because of the timing of Mr. Trump’s announcement — late evening in China, Japan and the Korean Peninsula, where news of his intended meeting with the North Korean leader, Kim Jong-un, is still sinking in.

In Iran, the official Islamic Republic News Agency’s website posted an unflattering photo of Mr. Pompeo, who has made clear he considers the Tehran government more of a threat than Mr. Tillerson did.

In Europe, where disdain for the Trump administration is widespread, Enrico Letta, a former Italian prime minister, said of Mr. Tillerson’s dismissal on Twitter: “This will make many laugh even more, as usually happens when one speaks of Trump. For me, he scares me more and more.”

The firing was announced only hours after Mr. Tillerson delivered the administration’s strongest and clearest statement to date on the March 4 poisoning of a Russian former spy in Salisbury, England, with a nerve agent.

“I’ve become extremely concerned about Russia,” Mr. Tillerson told reporters while flying from Nigeria to Cape Verde, before returning to the United States. “We spent most of last year investing a lot into attempts to work together, to solve problems, to address differences. And quite frankly, after a year, we didn’t get very far. Instead what we’ve seen is a pivot on their part to be more aggressive.”

He added: “And this is very, very concerning to me and others, that there seems to be a certain unleashing of activity that we don’t fully understand what the objective behind that is. And if in fact this attack in the U.K. is the work of the Russian government, this is a pretty serious action.”

Some speculated that Mr. Tillerson’s criticism of Russia might have been more than coincidental to his dismissal. Mr. Trump has avoided such criticism of Russia.

“Today Tillerson is fired as Secretary of State. While friction with Trump was months-old, the abrupt timing here is suspect,” Beau Willimon, the creator of the television series “House of Cards,” said on Twitter.

“Have they started blaming Russia yet for the Washington staff changes?” she said.

However, White House officials said the decision to fire Mr. Tillerson had been made earlier: The White House chief of staff, John Kelly, tried to call Mr. Tillerson on Friday and Saturday, apparently to warn him that if he did not step down, he would be dismissed.

Bill Kristol, a conservative commentator, questioned the style of the dismissal. “Has Trump ever had the nerve to fire someone face to face?” he asked on Twitter, noting that the former F.B.I. director, James B. Comey, learned that he was out of a job in March, while on a trip to San Francisco.

Jack Posobiec, a right-wing provocateur with a track record for disseminating false information, was one of a few prominent Trump supporters who embraced the decision.

“Tillerson didn’t want to name Jerusalem Israel’s capital, wanted to stay in Paris climate agreement, and often undermined the President publicly and insulted him privately” Mr. Posobiec said. “No surprise why this guy was fired.”