Walgreens Boots Alliance announced fiscal fourth-quarter earnings on Thursday, which exceeded Wall Street estimates, pushing its share price up 5%.

The positive news for the Deerfield, Illinois-based company comes amid its transition to a more health-care-oriented firm following Walgreen’s merger with Swiss-based pharmaceutical wholesaler Alliance Boots.

During the company’s fourth quarter ending August 31, earnings were 80 cents, adjusted, just ahead of Wall Street’s prediction of 77 cents. Revenue reached $32.45 billion, again above the $32.09 billion anticipated by analysts, according to CNBC.

According to Global CFO James Kehoe, the company did incur a substantial hit in the form of a $780 million noncash impairment charge related to trademarks and licenses in its Boots UK arm.

Walgreens has also felt the reduction in revenue stemming from fewer COVID-19 vaccinations. In fiscal Q4, the company administered 2.9 million shots, dropping from 4.7 million the quarter prior and substantially down from the 15.6 million doses in Q1 and 11.8 million in Q2, per CNBC.

The quarterly earnings release coincided with the latest inflation report, revealing prices in the economy persisted at a four-decade high. While the company acknowledges the coming year will be challenging, it still expects full-year adjusted earnings per share to reach between $4.45 and $4.65, roughly in line with analyst expectations, according to CNBC.

CEO Roz Brewer argued that Walgreens is in a favorable position to weather the economic downturn, as it relies on selling smaller items, not bulkier purchases like many bigger retailers.

Brewer highlighted that the company is in the business of selling “need now categories,” like toothpaste. Sales of these consumer staples tend to resist economic downturns as people do not readily stop brushing their teeth, for example, per CNBC.

The company’s pivot to a more health-care-centric business comes at a potentially opportune time.

Brewer stated, “With inflation at four-decade highs, consumers are expressing uncertainty about the future and seeking value… At the same time, we know that health and wellness will always be a priority and increasingly so after Covid-19.”

Walgreens’ transition is substantial. Last year it became the majority owner of the primary-care company VillageMD in a deal valued at $5.2 billion. The agreement paved the way for Walgreens to open hundreds of doctors’ offices around the country. At the end of the most recent quarter, VillageMD operated 334 doctors’ offices, 152 of which sit alongside Walgreens locations, according to CNBC.

The company’s evolution into a health-focused business is accelerating with the planned purchase of two other companies: CareCentrix and Shields Health Solutions.

CareCentrix focuses on at-home care benefits, while Shields Health Solutions specializes in pharmaceuticals. The acquisitions will help entrench Walgreens’ presence in the healthcare space.

The next 12 months “will be a year of accelerating core growth and rapidly scaling our U.S. Healthcare business,” stated Brewer.

Despite the boost to its share price following the earnings release, the company’s shares are still down substantially this year. Its stock has lost almost 39% of its value year-to-date, significantly higher than the S&P 500’s 25% drawdown.