Trump said Acosta initiated the resignation by calling him Friday morning and saying he felt he had become a distraction to the administration.
Years ago, Epstein had counted Trump and former President Bill Clinton among his friends, but Trump said this week he was "not a fan".
It turned out that the Acosta-engineered sweetheart deal gave him immunity from federal prosecution after a light sentence for crimes in Florida, but it did not give him immunity for his alleged exploitation of underaged girls in NY.
Two days after Epstein registered, state officials reversed course because in his case state law at that time required registration only if the victim was under the age of 16.
Acosta also faced criticism for keeping the federal deal not to prosecute Epstein a secret.
"Alex was a great Secretary of Labor and his service is truly appreciated", Trump said in a tweet. Epstein plead guilty to two counts of soliciting prostitution from a minor and was sentenced to just 18 months in prison, of which he served only 13.
The president famously does not like firing people, so you have to figure people around him let Acosta know it was time for him to go away. "Today's world treats victims very, very differently", adding that "today, our judges do not allow victim-shaming by defense attorneys". "He will be replaced on an acting basis by Pat Pizzella, the current Deputy Secretary".
Mr Acosta has served in Mr Trump's Cabinet since April 2017 and from 2005 to 2009 he was the United States attorney for the Southern District of Florida.
As the state attorney for Palm Beach County for 16 years [1993-2009] which included the entire period of the Epstein investigation, I can emphatically state that Mr. Acosta's recollection of this matter is completely wrong.
Asked if he would make the same deal now, Acosta responded: "We live in a very different world".
Acosta's role in the Epstein prosecution has been under greater scrutiny this week after Epstein was taken into custody and indicted on sex trafficking charges, in a rebuke to the Acosta deal.
But in recent years Mr Trump has sought to distance himself from Epstein and banned him from his Mar-a-Lago resort after criminal charges were filed against him. Among their frustrations were Acosta's decisions to proceed with several employment discrimination lawsuits and to allow certain Obama holdovers to remain on the job.
"It has meant so much to me that you have offered your steadfast support in your private discussions and in your public remarks", Acosta wrote.