Amazon (AMZN -0.56%) is no stranger to making headlines. But this year, the tech giant is taking a back seat to its fellow FAANG stocks like Microsoft and Alphabet, which are duking it out with new generative AI chatbots, and Apple, which announced the Vision Pro, its new spatial headset.

However, Amazon's stock price has quietly jumped 54% this year, riding the rebound in tech stocks. And the company tacked on some more gains in after-hours trading on Thursday after it released second-quarter earnings, topping estimates on the top and bottom lines.

Revenue rose 11% in the quarter to $134.4 billion, ahead of expectations at $131.6 billion. Guidance was also better than expected, calling for 9%-13% revenue growth in Q3. More importantly, Amazon saw a strong improvement in operating income, rising from $3.3 billion to $7.7 billion, primarily due to the impact of cost-cutting in its North American segment.

Let's take a look at three signs Amazon is gaining momentum after the latest quarter.

A chart showing Amazon's second-quarter performance

Image source: The Motley Fool.

1. AWS is stabilizing

Amazon gets the most attention for its e-commerce business, but Amazon Web Services (AWS), its cloud infrastructure juggernaut, has long brought in the lion's share of profits. In fact, it's been the only consistent source of profits for the company over its history, as the performance of the e-commerce business has been erratic.

In the second quarter, AWS generated $5.4 billion in operating income or more than two-thirds of the total. However, AWS' growth has slowed significantly over the last two years, which is one reason the stock is still down substantially from its pandemic-era peak. 

Revenue at AWS grew just 12% in the second quarter, but CEO Andy Jassy said, "Our AWS growth stabilized as customers started shifting from cost optimization to new workload deployment." That's an important shift, and one that should help top-line growth in AWS reaccelerate, giving a significant boost to profits.

2. Amazon's e-commerce profits are back

For just the first time in the last six quarters, Amazon posted a combined operating profit in its North America and International segments. The company has long struggled to generate a profit in e-commerce balancing investments in growth with the bottom line.

In North America, it reported an operating income of $3.2 billion, up from an operating loss of $627 million, while it narrowed its international operating loss from $1.8 billion to $895 million. Its advertising business, which is included in those segments, also delivered strong growth, with revenue up 22% year over year to $10.7 billion.

Management said on the earnings call that macroeconomic challenges were easing, but it still sees shoppers focusing on value. With the macro climate improving, the ad business remaining strong, and profitability expanding, the e-commerce division also looks set to drive the stock higher over the coming months.

3. Amazon's employee headcount is still falling

CEO Andy Jassy has embarked on Amazon's most aggressive cost-cutting campaign in its history. It's no secret that Amazon has gotten bloated with experiments that never paid off and a Prime Video division that costs $15 billion a year, but brings in little money directly.

Jassy also announced plans to lay off roughly 27,000 corporate employees early in the year, and the company's headcount fell for the third quarter in a row, down 4% to 1.46 billion. This is likely a factor of attrition at its warehouses as well as layoffs among corporate staff.

However, that approach also shows Jassy aims to be more judicious with hiring, which should also help the company maintain profitability as it grows. 

Time to buy Amazon stock?

With Amazon's annual revenue now over $500 billion, it will never be the high-growth company it was when it was smaller. So it makes sense to focus on profitability.

The second-quarter result shows those efforts are already starting to bear fruit, and profit margins should expand as the economy improves and management scrutinizes its costs further. 

With high-margin businesses like AWS and advertising, there's still a lot of room for Amazon's margins to expand. It's not too late to buy Amazon stock.