Finally, Walgreens catches a break.

Walgreens Boots Alliance (WBA) - Get Report fiercely beat Wall Street projections in its second-quarter earnings results Wednesday, March 28, reporting earnings per share of $1.73 versus the anticipated $1.55, according to Factset. The quarter ended on Feb. 28.

The retail pharmacy also exceeded the anticipated revenue of $32.2 billion, instead posting total sales of $33 billion, a 12% uptick from the same quarter last year and the highest sales growth in eight quarters, according to CEO Stefano Pessina. Comparable sales in stores rose 2.4% in the U.S., thanks to higher prescription volume and its alliance with Prime Therapeutics, a pharmacy benefit manager.

Within total store sales, pharmacy increased 5.1%, while retail comp sales decreased 2.7%.

Given the positive results, Walgreens raised its full-year guidance to earnings of between $5.58 to $6.05 per share.

TheStreet Recommends

Walgreens CEO Stefano Pessina

"Our growth strategy of increasing and consolidating volume, differentiating ourselves through value and quality of service, and controlling costs is bearing fruit across our businesses," Pessina said in a statement. "We expect to continue to grow, in part through the recent acquisition of stores from Rite Aid."

Walgreens is still integrating nearly the 2,000 Rite Aid stores it bought for $4.4 billion, which closed at the end of the quarter. 

The Deerfield, Ill.-based pharmacy chain got into hot water since the latter half of 2017 as its competitors veer further into the healthcare with mergers and strategic partnerships. CVS Health Corp. (CVS) - Get Report bought health insurer Aetna Inc. for $66 billion late last year, for instance, while Cigna Corp. (CI) - Get Report ponied up $52 billion for PBM Express Scripts earlier this month. It's no help that Action Alerts Plus holding Amazon.com Inc. (AMZN) - Get Report is also eyeing the retail healthcare space.

"The headwinds in the pharmacy retail industry are intensifying, and we do not see any relief in the medium term," Leerink Partners David Larsen said a November note. "We believe Amazon will be entering into the market within the next few years, and we believe WBA is most exposed to share loss."

Walgreens shares were up more than 2% Wednesday afternoon after-the-bell, trading at $67.59.