More than 50,000 Americans died from drug overdoses last year — the most ever.

The disastrous tally has been pushed to new heights by soaring abuse of heroin and prescription painkillers, a class of drugs known as opioids.

Heroin deaths rose 23 percent in one year, to 12,989, slightly higher than the number of gun homicides, according to government data released Thursday.

Deaths from synthetic opioids, including illicit fentanyl, rose 73 percent to 9,580. And prescription painkillers took the highest toll, but posted the smallest increase. Abuse of drugs like Oxycontin and Vicodin killed 17,536, an increase of 4 percent.

Get Breaking News Delivered to Your Inbox

“I don’t think we’ve ever seen anything like this. Certainly not in modern times,” said Robert Anderson, who oversees death statistics at the Centers for Disease Control and Prevention.

The new numbers were part of the agency’s annual tally of deaths and death rates in 2015.

Overall, overdose deaths rose 11 percent last year, to 52,404. By comparison, the number of people who died in car crashes was 37,757, an increase of 12 percent. Gun deaths, including homicides and suicides, totaled 36,252, up 7 percent.

As part of its annual report, the CDC also found that rates for 8 of the 10 leading causes of death rose last year, causing the nation’s life expectancy to go down for the first time in more than 20 years. Drug overdoses were a significant factor, but an unexpected increase in the death rate from heart disease, the nation’s No. 1 killer, was another major reason.