Amazon posted a 25 percent increase in net sales for the second quarter, to $38 billion, but profits plunged to $197 million, or 40 cents a share, down from $857 million in the same quarter last year, and significantly below Wall Street’s expectations for its bottom line.

The results indicate that Amazon is still spending heavily to grow its business. Analysts polled in advance of the earnings report expected Amazon to post $37.18 billion in revenue for the quarter, up 22 percent, with earnings of $1.42 per share. Amazon shares are down slightly in after-hours trading following the report.

RELATED: Another strong quarter for AWS: 42 percent jump in revenue to $4.1B

It was an eventful quarter, as Amazon announced an agreement to buy Whole Foods Market for $13.7 billion, the largest acquisition in the Seattle company’s history and sign of the company’s ambitions to expand well beyond online commerce into physical retail, blending its digital and logistics expertise. The deal has yet to close, however, so the Whole Foods acquisition didn’t have any direct impact on Amazon’s financials for the quarter.

Whole Foods profits declined more than 11 percent during the recent quarter, and a decline in same-store sales illustrated the growth challenges facing the upscale retail chain.

Amazon Web Services, the company’s market-leading cloud technology division, continued to climb with revenue of $4.1 billion, up from $2.9 billion. AWS operating income came in at $916 million, compared to $718 million in the second quarter last year.

Overall operating income for Amazon for the latest quarter was $628 million, down from $1.3 billion a year earlier but still within the broad range of $425 million and $1.075 billion that Amazon had told investors to expect. Its net sales of $38 billion exceeded the previous guidance of $35.25 billion and $37.75 billion.

Bullishness about the company’s prospects has led to a 40 percent surge in Amazon shares this year. Much of Bezos’ wealth comes from his 17 percent stake in Amazon, and earlier Thursday he surpassed fellow Seattle-area tech billionaire Bill Gates as the richest person in the world, with a net worth of $90 billion.

Amazon previously reported a 60 percent increase in sales during its summer shopping event, Prime Day, but that took place after the second quarter ended, and those results aren’t included in today’s earnings report.

UPDATE: Asked about the earnings miss on a conference call with reporters, Amazon CFO Brian Olsavsky noted that Amazon’s net sales topped its guidance, and operating income was within that wide range of guidance above. He also noted that AWS’ revenue run rate rose to $16 billion, from $14 billion.

As a result, he said, “Really all of the change year-over-year is in the investments area, which we’ve been pretty transparent on.”

Here’s how he described the focus of those investments.

“The main things that are driving that area are fulfillment capacity increases, including Amazon logistics, investments in digital video, devices, especially our Echo and Alexa platform. I will point out AWS infrastructure is growing very quickly. Capital leases that you’ll see on our financials grew 71 percent on a trailing 12-month basis, and that is primarily for our AWS business, where we’re seeing accelerating usage growth in many of our large services with customers. So that is something we will continue to invest in. And also the additional Prime Benefits that we will continue to expand on — everything from Prime Now to Amazon Fresh, to added selection and faster shipping times.”

Amazon also continued to hire at a rapid pace, adding another 31,000 employees in the quarter.

The company’s earnings conference call with investors and analysts starts at 2:30 p.m. Pacific time.

Like what you're reading? Subscribe to GeekWire's free newsletters to catch every headline

Job Listings on GeekWork

Find more jobs on GeekWork. Employers, post a job here.