What happened

Shares of Amazon.com (AMZN -1.64%) climbed 3.5% on Wednesday after a closely watched price index indicated that inflation was moderating. 

So what

The consumer price index (CPI) increased 8.5% year over year in July. That was better than the 8.7% rise economists expected and a notable improvement from the 9.1% year-over-year increase in June. 

The CPI measures the prices Americans pay for a wide array of goods and services. The index is widely used by investors, businesses, and government officials to monitor inflation levels.

The moderation in CPI growth was largely due to lower energy prices. Gasoline prices declined by 7.7% in July, which helped to offset higher food and housing costs.

Investors took the news as a signal that inflation might have already peaked. That could allow the Federal Reserve to pull back on its plan to raise interest rates, which many analysts feared could drive the economy into a recession.

With these risks now likely reduced, investors bid up stocks. The S&P 500 and Nasdaq Composite indexes both climbed more than 2% on Wednesday.

Now what

The positive CPI news was particularly bullish for Amazon. The e-commerce giant has seen its shipping and delivery costs soar due to higher gas and diesel prices. Should energy prices continue to fall, Amazon's profit margins should rebound.

A lower probability of a recession also benefits Amazon. Consumers tend to spend less on discretionary items during economic downturns. But if the economy were to continue to grow at a decent clip, consumer confidence and discretionary spending would likely rise. And that would no doubt lead to higher sales for the online retail titan.