Last year was a tough one for Amazon (AMZN -0.63%). The company's already-thin profit margins were further pressured by soaring costs. The perennially strong operating income of Amazon Web Services (Amazon's cloud-computing arm) was crimped, while Amazon's e-commerce operations swung to a loss.

This year's shaping up quite differently, though. Through a combination of cost cutting and more efficient management of its resources, Amazon is growing both its top and bottom lines again. In fact, the company's second-quarter profit progress could almost be considered heroic. Look for more of the same going forward.

Back in the black -- big-time

For the three-month span ended in June, Amazon turned $134.4 billion worth of sales into a per-share profit of $0.65. Both were an improvement on the year-ago comparisons of $121.2 billion and a loss of $0.58 per share, respectively, and both were better than the top line of $131.5 billion and bottom line of $0.35 per share analysts were expecting. 

Guidance for the quarter currently underway was pretty rosy as well. The company's looking for year-over-year sales growth of between 9% and 13%, which should be enough to generate between $5.5 billion and $8.5 billion worth of net income. In the same quarter a year earlier, Amazon only booked a net profit of $2.5 billion.

The bulk of this stock's post-earnings surge, however, arguably stems from evidence that the company's once-burgeoning costs are finally under control again. Nowhere is this more evident than with its North American e-commerce operation. Its sales grew 11% to $82.5 billion, but its costs only expanded half as much to reach $79.3 billion.

End result? The operating loss of $600 million booked in Q2 2022 was turned into an operating profit of $3.2 billion. That's the best quarterly profit Amazon's North American e-commerce arm has achieved since early 2021 -- at the height of the COVID-19 pandemic.

Chart showing the rekindled profits of Amazon's North American e-commerce operations in Q2 of 2023.

Data source: Amazon Inc. Chart by author. Figures are in billions of dollars.

It should be noted that lower product and service costs (like shipping) aren't the only contributing factor to this turnaround. The company's also been reducing its worker headcount, from 1.52 million then to 1.46 million as of the end of last quarter. Amazon also continues to grow its advertising business. The company collected nearly $10.7 billion worth of ad revenue in Q2, up 22% from the figure achieved in the comparable quarter of 2022. Service sales grew from $64.6 billion to $75.4 billion in Q2, far outpacing growth in sales of physical products.

In other words, the profit boost is the result of several factors. This dynamic is all the more reason for current and prospective shareholders to celebrate this rekindled profitability. Selling products requires spending on unpredictably priced services like shipping or the cost of the goods themselves. Advertising, Prime subscriptions, and sellers' services are a higher-margin and more predictable business.

Seeing the same from other Amazon arms

And North America's e-commerce operation isn't the only unit making clear profit progress. Although still in the red, Amazon's international e-commerce arm is losing less money than it was in the latter half of last year when costs were high but sales were weak. Last quarter's net loss of $900 million is the third straight quarter of profit improvement, paired with modest year-over-year sales growth.

Chart showing the rekindled profits of Amazon's international e-commerce operations in Q2 of 2023.

Data source: Amazon Inc. Chart by author. Figures are in billions of dollars.

Given the budding trend, it's conceivable that the international e-commerce unit will eventually be able to swing back to the profit finally achieved during the pandemic.

Perhaps the brightest of last quarter's bright spot is Amazon Web Services' (AWS') improved bottom line. Although the company's cloud-computing business only accounts for about 16% of Amazon's total revenue, it accounts for more than half of the company's usual operating profits. That's why last year's pinched profits were such a worry. If Amazon's biggest breadwinner can't produce the sort of profits it produced in the past, the stock's entire bullish thesis must be reconsidered.

We're seeing a glimmer of hope on this front, however. AWS' operating costs grew faster than its revenue did on a year-over-year basis last quarter. But on a sequential basis -- that is, compared to Q1 -- sales growth slightly outpaced expense growth. That's why AWS' operating profit improved slightly from Q1's bottom line.

Chart showing Amazon Web Services' rekindled profit growth in Q2 of 2023.

Data source: Amazon Inc. Chart by author. Figures are in billions of dollars.

Also notice that AWS' revenue growth simply accelerated in Q2 after flattening in Q1. That's another important component of widening profit margins on equipment that's already been purchased. 

More such progress may be in the cards for AWS, too. The lag between paying for cloud-computing infrastructure and then fully monetizing it can be significant. The bulk of the benefit of falling technology and hardware costs may not yet be fully reflected in AWS' profitability measures.

A good time to step into Amazon stock

Given the stock's post-earnings rally, the market's largely in agreement that Amazon's Q2 profit growth represents the new norm. Indeed, the big gain suggests that investors feel the company's likely to sustain these cost reductions, while at the same time it's streamlining the spending it can't cut and driving more and more higher-margin revenue (like ads, Prime, AWS, seller services, etc.).

The market is arguably right about this assumption too, making Amazon a compelling purchase again. A newcomer's only consideration here might be the sheer scope of Friday's jump. That's a tough act to follow, as some owners may be taking profits soon.

Just don't hold out too long waiting for a fantastic price. You might not get it. This isn't a stock with a history of making major pullbacks when the company's firing on all cylinders -- as it is again now.