What happened

Shares of the drugstore giant Walgreens Boots Alliance (NASDAQ:WBA) gained a healthy 10.8% during the month of June, according to data from S&P Global Market Intelligence. What sparked this abrupt turnaround?

Walgreens shares bolted higher last month in response to the company's better-than-expected fiscal third-quarter earnings report. Specifically, the drugstore behemoth reported $34.6 billion in revenue for the quarter, which topped Wall Street's consensus estimate by about $70 million. 

A red metallic ball on a string moving towards a series of four grayish metallic balls that are also attached to strings.

Image Source: Getty Images.

So what

Through the first five months of the year, Walgreens' shares had lost a staggering 26% of their value, thanks to an historically poor fiscal second-quarter earnings report combined with Amazon's potentially game-changing purchase of PillPack last year.

Shareholders, in turn, were apparently ready to cheer even a small win, evidenced by Walgreens' stock gaining a stately 10% on the news that its top line had simply flatlined -- instead of losing further ground -- in the most recent quarter, compared to the same period a year ago. 

Now what

Walgreens is stuck between a rock and a hard place. While the company's drastic cost-cutting measures should buoy its bottom line for a year or so, Walgreens desperately needs to find a new source of revenue growth. The long and short of it is that the retail landscape has forever changed with the emergence and subsequent maturation of e-commerce.

Moreover, Amazon's entrance into the world of prescription drugs could seriously harm Walgreens' core business. Stated simply, Walgreens needs to prove to investors that it indeed can adapt to the age of e-commerce.