Spending on prescription drugs nationwide has been slowing for years because of the increasingly widespread use of low-cost generics. But in 2012, something unheard-of happened: money spent on prescription drugs actually dropped.

The dip was small — 1 percent, to $325.7 billion — but it was the first time the research firm IMS Health had recorded a decrease in United States drug sales since the company began tracking such numbers in 1957. And this month, the pharmacy benefit manager Express Scripts reported that spending on commonly used pills — like those that treat high blood pressure and cholesterol — dropped by 1.5 percent, the first time that had happened since Express Scripts began following drug trends 20 years ago.

But even as the United States is in the midst of what has been called a “golden” period in spending on drugs, some are warning that the ever-expanding use of generics has masked a growing problem for the government, insurers and others who pay the bill for prescription drugs: the rising cost of complex specialty medicines that treat cancer, rheumatoid arthritis and other diseases.

“This is a charmed era that won’t last forever,” said Paul B. Ginsburg, the president of the Center for Studying Health System Change, a nonpartisan research group that studies health care trends. “When you talk to benefits managers at large employers or insurers, the trend of specialty pharma is very, very prominent. You might even say they regard it as their biggest problem.”