What happened

Shares of e-commerce giant Amazon (AMZN -0.48%) jumped 55.2% in the first half of 2023, according to data provided by S&P Global Market Intelligence. Interestingly, the market wasn't immediately impressed whenever the company reported quarterly financial results. But investors' optimism is steadily improving as Amazon cuts expenses in some areas and continues to invest cash in other areas.

To elaborate, Amazon reported financial results for the fourth quarter of 2022 on Feb. 2, and the stock fell about 8% the following day. Then on April 27, the company reported financial results for the first quarter of 2023, with the stock falling about 4% the day after that. Therefore, the headline numbers didn't catalyze the stock upward.

By contrast, Amazon saw strong, steady gains as it made announcements regarding its capital allocation plans -- how it's going to spend money. The company laid off many workers, discontinued certain products, and shuttered some operations, including permanently closing some underperforming Amazon Go convenience store locations.

So what

In recent years, business has boomed for Amazon. As CEO Andy Jassy pointed out in his annual letter to shareholders, Amazon's full-year revenue jumped from $245 billion in 2019 to $434 billion in 2022. However, this sharp increase in demand necessitated elevated levels of spending from Amazon to increase its infrastructure. And this elevated spending came at the expense of profits.

As the chart shows, Amazon's cash from operations dipped almost 50% from the start of 2021 through the middle of 2022. Unsurprisingly, Amazon stock dipped more than 50% during this time.

AMZN Capital Expenditures (TTM) Chart

AMZN Capital Expenditures (TTM) data by YCharts

The chart also shows that the ramp-up in capital expenditures and operating expenses has started to moderate for Amazon, and its cash from operations is consequently rebounding. 

Amazon stock was down as cash from operations dipped. Therefore, it's only logical that Amazon stock would bounce back as its cash from operations improved. And that's why it was up 55% in the first half of 2023.

Now what

Amazon is improving its profitability by cutting costs. But Jassy is still investing for top-line growth. And the company expects much of that growth to come from its cloud computing service Amazon Web Services (AWS).

To illustrate, in May, Amazon announced that it would spend $12.7 billion in India through 2030 to develop its AWS offering in that country. It's a smart move to invest in India, considering the rate at which its economy is growing. In fact, Goldman Sachs believes it will surpass the U.S. economy by 2075.

Additionally, many investors believe that artificial intelligence (AI) is an enormous growth opportunity for the coming decade. Therefore, Amazon's shareholders should be encouraged that it's investing in this area too. In fact, its recently launched Amazon Bedrock provides tools to other developers when creating AI applications, making Amazon a vital infrastructure AI stock.

All this means Amazon stock is up because it's cutting certain expenses while still investing in its future growth. That's a combination that investors appreciate and could provide future market-beating gains for Amazon stock as well.