Trump said that Comey was no longer able to effectively lead the law-enforcement agency.
Comey attracted controversy and criticism from across the political spectrum during his short tenure.
Under his leadership the FBI worked on key investigations, including those of former secretary of state Hillary Clinton's use of a private email server and of possible links between Russia and Trump's election campaign.
In July 2015 the FBI began a "full investigation" into whether Clinton's use of an email server and handling of classified information while US secretary of state compromised national security.
Several months earlier, Clinton had announced that she was running for president.
Comey was widely criticised for heavy-handed and high-profile decisions in the case.
Comey had said in July 2016 that the Clinton email case should be closed without prosecution, but then declared on October 28 that he had reopened the investigation because of a discovery of a new trove of Clinton-related emails.
The timing of the statement sparked outrage from Democrats, coming only 11 days before the November 8 election in which Clinton was the Democratic nominee.
On November 6, Comey told Congress in a letter that the FBI had not changed its opinion that Clinton should not face criminal charges.
But Clinton said last week that she partly blames Comey's decision for her election loss.
In testifying this month to a US Senate committee, Comey said it made him "mildly nauseous" to think that revealing a renewed investigation into Clinton's emails in late October "might have had some impact on the election," although he stood by his decision.
Comey had also been leading an FBI investigation into allegations of Russian meddling in the 2016 US presidential election and possible collusion with Trump's campaign.
US intelligence agencies have concluded that Russia tried to help Trump by hacking leading Democrats.
Comey said that, while the Russian government wanted to hurt Clinton's campaign and help Trump's, intelligence agencies made no judgment on whether the efforts influenced the outcome.
CNN meanwhile reported this week that grand jury subpoenas had been issued by federal prosecutors to associates of former national security adviser Michael Flynn in connection with their investigation.
Former acting attorney general Sally Yates, a Barack Obama appointee who was sacked by Trump early in his presidency, this week testified before the Senate Judiciary Committee and said she told the White House six days into Trump's administration that Flynn, a former military intelligence chief, had not been honest with Vice President Mike Pence about his discussions with the Russian ambassador to Washington, leaving him vulnerable to leverage from Moscow.
It nevertheless took 18 days before the president, pressed by Pence and others, dismissed the retired army lieutenant general, who had advised him on security issues throughout the 2016 presidential campaign.
"We believed that General Flynn was compromised with respect to the Russians," Yates told the hearing in her first public comments on the scandal.
The Trump administration blamed numerous mistakes Comey made in his handling of the investigation into Clinton's emails for the dismissal decision.
At the time, Trump praised Comey for having "guts" and doing "the right thing", statements that complicate his assertion that now, seven months later, Comey's decisions warranted firing.
A letter by Trump to Comey on Tuesday made no mention of the Clinton email scandal, appearing instead to refer to the Russia probe.
Trump has repeatedly dismissed Comey's Russia investigation - as well as the congressional inquiries - as a "hoax." He has also insisted that he is not personally under investigation - asserting in the letter on Tuesday that Comey told him three times that he was not a target - though the FBI has stated unequivocally that the president's campaign and his associates are facing scrutiny.
Comey's sacking prompted angry Democrats to call for the Russia investigation to be placed in the hands an independent prosecutor or commission.
A Republican lawyer, Comey was nominated to the FBI in 2013 by President Obama, a Democrat.
The US Senate approved his nomination by a vote of 93-1.
Comey had been a senior Department of Justice official in the George W Bush administration, where he gained prominence for standing up against an electronic surveillance programme and even threatening to resign over what he saw as illegal aspects of the programme.
During his confirmation hearing, however, Comey defended the government's widespread surveillance of telephone records and internet communications, saying there were oversight mechanisms that sufficiently protected Americans' privacy.
Before serving as FBI director, Comey oversaw prosecution in the 1996 Khobar Towers bombing in Saudi Arabia, in which 19 US soldiers died.
Comey also served as US lawyer for the Southern District of New York in Manhattan.
Source: Al Jazeera and news agencies