"Andrew McCabe FIRED, a great day for the hard working men and women of the FBI - A great day for Democracy," Trump tweeted soon after the firing, AFP reported.
"Sanctimonious [ex-FBI director] James Comey was his boss and made McCabe look like a choirboy. He knew all about the lies and corruption going on at the highest levels of the FBI!" Trump wrote.
McCabe pushed back hard at the decision, saying he was the victim of a "war" by the Trump administration against both the FBI, and the special counsel probing allegations of Russian election meddling.
Announcing McCabe's ouster, the Justice Department said an internal investigation found that he had made unauthorized disclosures to the media, and had not been fully honest "on multiple occasions" with the department's inspector general.
"The FBI expects every employee to adhere to the highest standards of honesty, integrity and accountability," Attorney General Jeff Sessions said in a statement.
The decision was taken "after an extensive and fair investigation," Sessions said.
Details of the inspector general's probe were not made public, but it involved the FBI's handling of the 2016 investigation into Trump's election rival, Democrat Hillary Clinton.
Trump has repeatedly accused McCabe and Comey of having protected Clinton from prosecution over her misuse of a private email server while she was secretary of state, and over the actions of the private Clinton Foundation set up by her husband, former president Bill Clinton.
Trump was also publicly upset about McCabe's defense of Comey – whom the president fired in May 2017 in frustration at the ongoing FBI probe into alleged collusion between his election campaign and Russia.
McCabe hit out following his sacking in a blistering statement.
"I am being singled out and treated this way because of the role I played, the actions I took, and the events I witnessed in the aftermath of the firing of James Comey," McCabe said.
McCabe said the inspector general's probe "became part of an unprecedented effort by the administration, driven by the president himself, to remove me from my position, destroy my reputation, and possibly strip me of a pension that I worked 21 years to earn."
"This attack on my credibility is one part of a larger effort not just to slander me personally, but to taint the FBI, law enforcement, and intelligence professionals more generally," McCabe said.
"It is part of this administration's ongoing war with the FBI and the efforts of the special counsel investigation."
McCabe denied any impropriety in speaking with the media about the Clinton probe, and denied that he handled the probe with any bias.
He also denied having deliberately lied to the inspector general.