Make it three in a row for CVS Health (CVS -1.62%) -- in two different ways. The big healthcare company announced its third-quarter results on Wednesday, and for the third-consecutive quarter, CVS beat Wall Street earnings estimates. It reported Q3 adjusted earnings per share (EPS) of $2.09, well above the $1.99 expected by analysts.

In addition, CVS raised its adjusted EPS guidance for the third time this year. The company now expects full-year 2022 adjusted EPS of between $8.55 and $8.65, up from its previous forecast of $8.40 to $8.60.

Investors reacted favorably to the news. But is CVS Health stock a buy after the Q3 earnings beat? 

First, the bad news

CVS Health provided a positive Q3 update. However, there were some areas of concern.

CEO Karen Lynch revealed in the company's quarterly conference call that Centene is taking its pharmacy-services business to a competitor in 2024. That's a significant loss that CVS certainly didn't want.

The company's Aetna national Medicare preferred provider organization (PPO) plan also saw its rating drop from 4.5 stars to 3.5 stars. Lynch acknowledged management's disappointment in this decline after nearly 10 years of achieving ratings of 4.0 stars or better.

CVS Health CFO Shawn Guertin said that the combined impact of Centene's departure and the lower Medicare rating will be around $2 billion in 2024 without any mitigation efforts. The company plans to repurchase shares to help address the upcoming earnings headwinds. However, Guertin noted that CVS will likely add more debt to fund these buybacks. 

In addition, Guertin stated that CVS anticipates that "the economics on vaccines and diagnostic testing will change following expiration of the public health emergency, which we project will happen in the early part of the first quarter of 2023." In other words, COVID-19 probably won't provide the boost going forward for the company that it has over the past couple of years.

A lot to like

With that bad news out of the way, there's still a lot to like about CVS Health's direction. Even with the challenges that it faces, the company expects earnings growth in 2023.

CVS hopes to close its pending acquisition of Signify Health in the first half of next year. This deal will enable the company to expand into the home-healthcare services market.

The 2019 acquisition of Aetna appears to be achieving CVS' goals. Lynch said that the company reached a major milestone in Q3 with over 2 million members enrolled in its integrated Aetna/Caremark products.

Sometimes, the smart move is to divest weaker-performing units. CVS Health recently sold human-resources technology company bswift. It's "exploring strategic alternatives" for the Omnicare long-term care pharmacy business. Lynch noted that Omnicare doesn't fit well into the company's overall portfolio. 

CVS also appears to finally be on track to move past the dark cloud hanging over its head related to opioid litigation. The company announced an agreement in principle to pay around $5 billion over a 10-year period, beginning in 2023. This settlement should at long last enable CVS to put the issue behind it.

Two deciding factors

Ultimately, I think there are two deciding factors that work in favor of buying CVS Health stock.

First, the stock is attractively valued. CVS shares trade at under 7 times levered free cash flow (FCF). Even if we include debt in the valuation, its enterprise value is still only a little over 10 times levered FCF.

Second, long-term aging-demographic trends should help CVS Health. The demand for Aetna's Medicare plans should grow. The company's retail pharmacies stand to increase sales and profits, as well.

Investors should emphatically not buy CVS Health stock just because of its Q3 earnings beat. But my view is that the stock is a pretty good pick overall.