Trump, who has fired numerous cabinet and other administration officials during his 2 1/2 years in the White House, said it was Acosta's idea to step down.
"Alex called me this morning and wanted to see me," Trump told reporters. "I just want to let you know this is him, not me."
Acosta's resignation is effective in seven days. Trump named deputy Labor secretary Patrick Pizzella as the acting secretary.
Acosta has served in Trump's cabinet since April 2017 and from 2005 through 2009 was the US attorney for the Southern District of Florida. It was there that he handled Epstein's first case involving sex with girls, which resulted in a punishment that critics say was far too lenient.
"Mr Acosta now joins the sprawling parade of President Trump's chosen advisers who have left the administration under clouds of scandal and corruption, leaving rudderless and discouraged agencies in their wake. Taxpayers deserve better," Democratic US Senator Sheldon Whitehouse said in a statement.
Epstein, a billionaire hedge fund manager, pleaded not guilty to new federal charges in New York this week. Epstein had a social circle that over the years has included Trump, former president Bill Clinton and Britain's Prince Andrew.
Nancy Pelosi, the Democratic speaker of the House of Representatives, and Democratic Senate Majority Leader Chuck Schumer had called on Tuesday for Acosta to resign.
Acosta responded to the criticism on Tuesday with tweets saying Epstein's crimes were "horrific" and that he was glad prosecutors were moving forward based on new evidence and testimony that could "more fully bring him to justice".
On Wednesday, Acosta held a news conference to defend his handling of the deal, which allowed Epstein to plead guilty to a state charge and not face federal prosecution. Acosta said Epstein would have had an even lighter sentence if not for the deal.
US prosecutors in New York on Monday accused Epstein, 66, of sex trafficking, luring dozens of girls, some as young as 14, to his luxury homes and coercing them into sex acts.
Democratic US Representative Elijah Cummings, chair of the House Oversight and Reform Committee who has called on Acosta to testify on the Epstein matter, said in a statement: "Secretary Acosta's role in approving the extremely favourable deal for Jeffrey Epstein raises significant concerns about his failure to respect the rights of the victims, many of whom were children when they were assaulted."
The federal prosecutors in New York said they were not bound by the deal arranged by Acosta, which allowed Epstein to plead to a lesser offence and serve 13 months in jail with leave during the day while registering as a sex offender.
In February, a federal judge in West Palm Beach, Florida, ruled that the 2007 agreement violated the victims' rights. Epstein's case and Acosta's role in the plea deal had come under scrutiny earlier this year after an investigation by the Miami Herald.
The Epstein case came up during Acosta's Senate confirmation hearing but the Republican-majority Senate approved him in a 60-38 vote.