Larry Merlo, president and chief executive officer of CVS Health Corp., speaks during an Economic Club of Washington discussion in Washington, D.C., U.S., on Monday, Oct. 15, 2018.

An improving pharmacy retail business helped CVS Health beat analysts' third-quarter earnings and revenue expectations. The company also said Tuesday it anticipates its acquisition of health insurer Aetna to close before Thanksgiving.

Shares of the company rose about 2 percent.

Here's what the company reported compared with what Wall Street was expecting, based on a survey of analysts by Refinitiv:

Earnings per share: $1.73, adjusted, vs. $1.71 expected

Revenue: $47.3 billion vs. $47.2 billion expected

CVS reported fiscal third-quarter net income of $1.39 billion, or $1.36 per share, up from $1.29 billion, or $1.26 per share a year earlier. Excluding items, CVS earned $1.73 per share, above the $1.71 per share expected by analysts surveyed by Refinitiv.

Revenue rose 2.4 percent to $47.3 billion, surpassing expectations of $47.2 billion. For the business unit that includes CVS' retail pharmacy operations, revenue increased to $20.86 billion, up nearly 7 percent from the $19.59 billion in the year-ago quarter, driven by an 8.4 percent surge in pharmacy revenue.

The company's retail business showed signs of improvement, with revenue from the so-called front store, which includes products like makeup and vitamins, increasing 2 percent from last year. Same-store sales, a closely watched metric, were up 0.8 percent. While the trends improved, they were up against easy comparisons.

"While this is a shallow gain, it is most definitely a step in the right direction," said Neil Saunders, managing director of GlobalData Retail. "However, our outlook on the retail side remains cautious, and we are split as to whether this represents the start of a new upside for CVS' retail operation, or whether it is just an anomaly."

Like other drugstores, CVS is searching for ways to lure shoppers who are increasingly shopping online. One solution might be CarePass, a membership program CVS is piloting in Boston.

To shake up its business model, CVS is in the midst of acquiring health insurer Aetna for roughly $69 billion. CVS received preliminary approval from the Department of Justice in October to move forward with the deal. The company still needs a handful of states to clear the deal, including New York, where state officials are considering blocking parts of it.

CVS on Tuesday said it has received approval from 23 of the 28 states it has filed with and is "well down the line" with the remaining five. The company expects to close the deal before Thanksgiving.

The company backed its full-year forecast of adjusted earnings of $6.98 to $7.08 per share. Analysts polled by Refinitiv expect $7.04 per share.

WATCH: Will Apple replace your family doctor?