Up by a whopping 55% year to date, Amazon's (AMZN -2.04%) stock is finally beginning to shake off the post-pandemic slump it endured for most of last year. While the company still faces some challenges in its e-commerce and cloud computing divisions, rebounding profitability and a pivot to artificial intelligence (AI) could help power continued success. 

The bottom line is beginning to normalize

Amazon has always excelled at generating tons of revenue because its core third-party e-commerce marketplace relies on moving large volumes of goods. But these sales don't always translate to profits. And this challenge mounted as post-pandemic inflation ate into Amazon's margins for much of 2022 and 2023. But the company's most recent earnings show that there is light at the end of the tunnel. 

Second-quarter net sales grew by a modest 11% year over year to $134.4 billion. But the real story was operating income, which surged by a whopping 132% to $7.68 billion. The blowout was driven by Amazon's North American e-commerce division and suggests management's aggressive cost-cutting efforts are bearing fruit. 

The company has eliminated 27,000 positions since the fall of 2022, while closing down underperforming in-house brands and reducing investments in newer verticals like healthcare and groceries. The company has also reworked its fulfillment system by transitioning from a national network to a series of eight separate regions, making delivery faster and cheaper. And while these efforts have had a dramatic near-term effect, they should also produce a long-lasting tailwind for the company's bottom line. 

Cloud computing and AI could power growth

While Amazon's cost-cutting is excellent news for investors, it's not enough to support the entire bull thesis for the stock. Thankfully, the company also has two strong top-line growth drivers: cloud computing (Amazon Web Services, AWS) and artificial intelligence. 

Green arrow moving upwards on a stock chart.

Image source: Getty Images.

Unlike Amazon's e-commerce business, AWS has been slower to see its margins improve. While the segment's second-quarter revenue jumped 12% year over year, operating income fell by 6% (to $5.4 billion) as clients continue optimizing their spending by reducing workloads and switching to lower-priced service tiers. The good news is that this is a transitory problem because AWS helps clients expand and innovate, so they will likely return when they are more confident in the state of the economy. 

Artificial intelligence is another huge opportunity. Amazon has developed a platform called Bedrock, designed to allow businesses to scale customized generative AI applications without the cost and complexity of building them from scratch. Bedrock could help boost growth and protect the economic moat of Amazon's technology business. 

What about the price tag?

With a stock price of $133 per share, Amazon is still down roughly 28% from its all-time high of $186 reached in mid-July. But with a forward price-to-earnings (P/E) multiple of 61, the company is still significantly more expensive than the S&P 500 average of 25. 

That said, investors should look at Amazon's cost-cutting as a lasting tailwind instead of just a second-quarter fluke. The company also still has room for recovery in the cloud-computing business, which could add further long-term support to its bottom line. The shares still look like a buy.