WASHINGTON — President Trump on Tuesday ousted his secretary of state, Rex W. Tillerson, extending a shake-up of his administration, 14 months into his tumultuous presidency, and potentially transforming the nation’s economic and foreign policy.

Mr. Trump announced he would replace Mr. Tillerson with Mike Pompeo, the C.I.A. director and former Tea Party congressman, who forged a close relationship with the president and is viewed as being more in sync with Mr. Trump’s America First credo.

Mr. Tillerson learned he had been fired on Tuesday morning when a top aide showed him a tweet from Mr. Trump announcing the change, according to a senior State Department official. But he had gotten an oblique warning of what was coming the previous Friday from the White House chief of staff, John F. Kelly, who called to tell him to cut short a trip to Africa and advised him “you may get a tweet.”

It was an abrupt end — after months of speculation — to a rocky tenure for a former oil executive who never meshed with the president who hired him. Mr. Tillerson clashed repeatedly with the White House staff and broke publicly with Mr. Trump on issues ranging from the dispute between Saudi Arabia and Qatar to the American response to Russia’s cyber aggression.