Macroeconomic difficulties have hit Amazon (AMZN -0.17%) hard this year. Inflationary pressures added billions of dollars in incremental expenses during the last few quarters, due in large part to higher fuel and shipping costs, rising wages, and supply chain disruptions.

More broadly, inflation hit a 41-year high of 9.1% in June, meaning rising prices have outpaced the 2% target set by the Federal Reserve for 16 consecutive months. This implies that consumer spending is under serious pressure, and discretionary purchases are often the first thing to get cut. Not surprisingly, many retailers have seen their share prices plunge in recent months, and Amazon is no exception. The stock is down 40% from its high.

However, Amazon gave shareholders a reason to smile on Thursday, when it published a press release detailing the results of Prime Day. Consumers purchased more than 300 million items during the two-day event, a 20% increase from the prior year, making 2022 the biggest Prime Day on record.

Is it time to buy the stock?

The biggest Prime Day ever

Not many businesses have the brand authority to create their own holiday, but Amazon is not an average business. The company hosted its first Prime Day in 2015, and the event has since become the midyear equivalent of Black Friday.

Home goods, consumer electronics, and Amazon-branded devices were the most popular categories this year, and the hot-ticket items included kitchenware from Hamilton Beach and Le Creuset, the Apple Watch Series 7, Levi's apparel, and Echo devices. In total, Prime members worldwide purchased 100,000 items per minute, and Prime members in the U.S. accounted for about 60% of that figure.

Amazon didn't provide specific dollar totals, but Adobe estimates that Prime Day sales reached $11.9 billion this year, up roughly 8% from the prior year. Additionally, the event may have helped Amazon grow its Prime membership count, which currently sits at over 200 million, because only Prime members can participate in the savings.

In short, Prime Day was a shinning success for Amazon. But that doesn't mean the stock will rebound anytime soon.

The market is clouded by a great deal of macroeconomic uncertainty. The Federal Reserve may get even more aggressive in its efforts to rein in inflation, and that could push the economy into a recession.

That being said, this still looks like a good time for patient investors to buy the stock.

The right reasons to buy the stock

Amazon operates the world's most popular e-commerce marketplace as measured by web traffic, and it powered more than 40% of online retail sales in the U.S. last year, according to eMarketer. For context, Walmart ranked second with just 7.2% market share. In fact, Amazon accounted for more sales than the next 14 retailers combined.

Better yet, the company has invested billions in fulfillment and logistics, reinforcing its industry leadership with an arsenal of warehouses, planes, and trucks. To that end, Amazon has consistently been a trailblazer in terms of fast and reliable delivery. That not only creates a great experience for buyers, but it also helps Amazon control shipping costs and makes the marketplace more attractive to merchants.

However, Amazon doesn't stop with e-commerce. Amazon Web Services (AWS) dominates the cloud computing industry. It captured 33% market share in cloud infrastructure spend in the first quarter, more than Microsoft Azure and Alphabet's Google Cloud Platform combined. That strength stems for its first-mover status and its capacity for innovation. Today, AWS offers far more services (and more features within those services) than any other cloud vendor.

While Amazon saw retail sales decelerate sharply in the first quarter, AWS saw revenue growth accelerate to 37%. Better yet, AWS achieved an operating margin of 35.3%, while the retail business hasn't cracked 6% in the past year. That means Amazon should become more profitable as AWS becomes a larger portion of total revenue.

Here's the bottom line: Amazon has a strong competitive position in both e-commerce and cloud computing, and both industries are expected to grow quickly. Online retail sales will increase by nearly 11% per year to reach $7.4 trillion by 2025, according to eMarketer. And cloud computing spend will grow at nearly 16% per year to reach $1.6 trillion by 2030, according to Grand View Research. That means Amazon still has a sizable runway for growth.

Additionally, shares currently trade at 2.4 times sales, near the cheapest valuation in the past five years. That's why now looks like a good time to buy.