Pricey, name-brand prescription medications continue driving up drug spending even though more patients are getting cheaper generics, according to a study released Wednesday.

And the spending is not necessarily driven by the hugely expensive but startlingly effective cancer drugs that are grabbing headlines. Most money goes to three exclusive drugs used to treat rheumatoid arthritis, Crohn’s disease and other autoimmune diseases, the analysis shows.

Federal health officials and the health insurance industry have been encouraging doctors to prescribe more generic drugs in the hope of saving money, and they are. But new data from the Blue Cross and Blue Shield Association shows that its insurance company members are paying out more than ever for specialty name-brand drugs.

“Expensive branded prescription drugs accounted for only 17 percent of total prescriptions filled, but 79 percent of total prescription drug spending ($79.5 billion),” Blue Cross Blue Shield said in its report.

“More expensive branded prescription drug spending is up 4 percent since 2016.”

Drug prices are a major target of patient groups and Congress. Although drug spending makes up only 10 percent of the $3.3 trillion spent on U.S. healthcare in a year, the sometimes eye-watering prices charged for new cancer, hepatitis and immune therapy treatments regularly attract criticism.

Most Americans get their health insurance coverage, including coverage for prescription drugs, from an employer’s provision of private health insurance. Blue Cross Blue Shield’s analysis looks at drug spending from the perspective of a major private insurer.

The company’s researchers analyzed medical claims from 41 million clients, and extrapolated them to the 88 million people covered by BCBS.

The company shells out $100 billion for prescription drugs, or 20 percent of all its spending.

“Total prescription drug spending increased 10 percent annually since 2010,” the report found. And most prescriptions — 82 percent — were for cheaper, generic drugs.

But most of the spending went for brand-name prescription drugs. “Expensive branded drugs accounted for only 18 percent of total prescriptions filled, but 78 percent of total spending,” the report reads.

“Costs for single-source drugs with no generic alternatives increased at more than double the rate of average annual drug spending.

Although new cancer immunotherapies and hepatitis drugs grab the headlines with their $100,000-plus price tags, the biggest costs came from three top rheumatoid arthritis drugs: Humira, Remicade and Enbrel, the analysis showed.

A quick-acting insulin, Novolog, was the fourth-leading cost-driver and Neulasta, an immune-boosting product for cancer patients, came in fifth.

Humira, an anti-inflammatory drug that tamps down the immune system, is currently the best-selling drug in the world. It costs about $38,000 a year, according to SSR Health. The spending is high in part because rheumatoid arthritis is so common, affecting 1.3 million to 1.8 million Americans.

The analysis does not include the effects of drug rebates, which companies often cite as a way to reduce the costs for their products.

“Steady annual increases in branded patent-protected prescription costs drive the majority of spending in the branded drug space, growing 5 percent in the past year alone,” the report concludes.

In 2017, the independent Institute for Clinical and Economic Review found that targeted treatments for rheumatoid arthritis were highly effective but probably cost more than they were worth.