CVS Health booked a third-quarter loss of more than $3 billion after setting aside money for a potential opioid litigation settlement but still beat expectations and raised its 2022 forecast.

The health care giant detailed on Wednesday a planned nationwide settlement of lawsuits over how it has handled prescriptions for powerful painkillers linked to an overdose epidemic.

The company set aside $5.2 billion in the recently completed quarter to cover payments over 10 years under a deal that, if accepted, would be one of the largest settlements over the crisis.

CVS Health spokesman TJ Crawford said he had “nothing to share at this time,” when asked whether any states or tribes had said they would accept the settlement or if it had been offered to them. But he said in an email that the company was “encouraged by the level of participation in other national opioid settlements with manufacturers and distributors.”

In the third quarter, CVS Health saw sales growth in all three of its main businesses as total revenue climbed 10% to $81.2 billion.

Adjusted earnings, which don’t count one-time items like the settlement, totaled $2.09 per share.

Analysts expected, on average, adjusted earnings of $2 per share on $76.74 billion in revenue, according to FactSet.

CVS operates one of the nation’s largest drugstore chains with nearly 10,000 retail locations. It runs prescription drug plans for big clients like insurers and employers through a large pharmacy benefit management business.

It also provides health insurance for more than 24 million people through its Aetna arm.

The company now expects adjusted earnings of $8.55 to $8.65 per share for the year, a higher and narrower forecast than it made in August.

FactSet says analysts predict, on average, earnings of $8.55 per share.

Shares of CVS Health Corp., based in Woonsocket, Rhode Island, climbed nearly 2% before the opening bell.

___

Follow Tom Murphy on Twitter: @thpmurphy