Shares of Amazon (AMZN -1.54%) surged 13.6% in Thursday's after-hours trading session after the e-commerce and cloud-computing leader released a second-quarter 2022 report that pleased investors. 

The market's reaction is largely attributable to second-quarter revenue beating the Wall Street consensus estimate and the company's own guidance, second-quarter operating income also coming in higher than the company's outlook, and third-quarter revenue guidance exceeding the Street's expectation.

Here's an overview of Amazon's second quarter and guidance centered around five key metrics.

Amazon packages moving on conveyor belts in a distribution center.

Image source: Amazon.com

1. Revenue grew 7%

Amazon's net quarterly sales grew 7% year over year to $121.2 billion, surpassing the $119.1 billion Wall Street had expected. That result also slightly beat the company's guidance range of $116 billion to $121 billion. Excluding the headwind from foreign-currency exchange, revenue increased 10% from the year-ago period.

The company's revenue performance was stronger than the percentage growth numbers suggest. That's because its annual Prime Day event was in the second quarter last year and the third quarter this year. 

For context, in the first quarter, reported revenue grew 7% year over year, while revenue in constant currency rose 9%.

Here's how second-quarter revenue broke down by segment:

Segment Q2 2022 Revenue Change YOY (Decline)
North America $74.4 billion 10%
International $27.1 billion (12%)
Amazon Web Services (AWS) $19.7 billion 33%
Total $121.2 billion 7%

Data source: Amazon.com. YOY = year over year.

As is nearly always the case, AWS revenue growth was powerful. 

The North America segment's performance was particularly impressive given the previously mentioned quarter-shifting of Prime Day and the high-inflation macroenvironment. As to the latter point, other giant retailers -- such as Walmart -- are reporting that consumers are notably paring back their discretionary spending. Amazon's results suggest that its North America business is not feeling this pinch as much as others in the industry.

2. Operating income fell 57%, but beat guidance

Operating income decreased 57% year over year to $3.3 billion. Nonetheless, this result exceeded Amazon's guidance range of an operating loss of $1 billion to operating income of $3 billion, as outlined in my earnings preview.

Segment Q2 2022 Operating Income Change YOY
North America ($627 million) Result was $3.1 billion in the year-ago period.
International ($1.8 billion) Result was $362,000 in the year-ago period.
Amazon Web Services (AWS) $5.7 billion 36%
Total $3.3 billion (57%)

Data source: Amazon.com.

Thanks to AWS being super profitable, Amazon is able to lose money on its other two businesses and still post an operating profit.

3. EPS was negative, but only due to the valuation loss on Rivian stock

Net loss was $2 billion, or $0.20 per share, compared with net income of $7.8 billion, or $0.76 per share, in the year-ago quarter. This result fell considerably short of the analyst consensus estimate of $0.13 per share. (The consensus was $0.16 at the time of my earnings preview.) 

The sole reason that the bottom line was negative was a pre-tax valuation loss of $3.9 billion included in nonoperating expense from the company's common stock investment in Rivian Automotive, which went public in November. 

Absent this Rivian stock valuation loss, Amazon would have reported a profit, not a loss. But we can't know what the exact profit would have been because we don't know what the company's income tax would have been. My back-of-the-envelope calculation indicates that absent the Rivian stock valuation loss, earnings per share (EPS) would probably have just slightly missed the the $0.13 Wall Street estimate.

4. Operating cash flow declined 40%

Operating cash flow fell 40% year over year to $35.6 billion for the trailing 12 months. Free cash flow was negative $23.5 billion for the same period, compared to positive $12.1 billion for the year-ago period.

Operating cash flow is the best cash flow metric to follow. Free cash flow will vary considerably based upon how much money Amazon is investing in growth initiatives.

Operating cash flow relative to a year ago has been hurt due to increased inflationary pressures on input costs. 

5. Third-quarter revenue is expected to grow 13% to 17%

For the third quarter, Amazon guided for net sales in the range of $125 billion to $130 billion, which would equate to year-over-year growth of 13% to 17%. Going into the report, Wall Street was modeling for third-quarter revenue of $126.4 billion, so Amazon's guidance, at the midpoint of its range, came in a little higher than analysts had been expecting.

Third-quarter revenue will get a boost from Prime Day being held in the quarter, versus the second quarter last year.  

Amazon (which doesn't provide earnings guidance) also expects that its third-quarter operating income will be between $0 and $3.5 billion, compared with $4.9 billion in the year-ago period.

For additional context, going into the report, Wall Street had been modeling for third-quarter EPS to decline 3% year over year to $0.32. The company's operating-income guidance suggests management expects a more significant decline.

A solid quarter given the macroeconomic environment

Amazon turned in a better quarter than many investors were probably expecting. It was far from a strong quarter, but it was a solid one in the context of the macroeconomic environment. Inflation is high and many consumers and business leaders are concerned that a U.S. (or global) recession is on the horizon.