By Greg Bensinger 

Amazon.com Inc. surprised investors by reporting an unexpected profit along with the sharp sales gains that it regularly produces.

Following the results, shares of the Seattle online retailer jumped 18% to $567.50 in after-hours trading, which would represent a new all-time high for the story and, for the moment, value Amazon above Wal-Mart Stores Inc.

For the June quarter, Amazon earned $92 million, up from a year-ago loss of $126 million and above the loss of $52.2 million expected on average by analysts surveyed by Thomson Reuters.

Sales, meanwhile, rose a better-than-expected 20%.

A bright spot for Amazon was its cloud computing division, Amazon Web Services, which disclosed sales for just the second time in Amazon's 20-year history. Some believe the unit could operate on a stand-alone basis and, because of its growth, is a primary reason to invest in Amazon.

Sales at the division rose 81% to $1.82 billion from $1 billion a year earlier, while operating profit more than quadrupled to $391 million from $77 million.

Amazon's overall sales growth has kept investors happy in recent quarters--the stock was up more than 50% this year before the earnings report Thursday--even as the company continued to report losses.

The bottom-line losses reflect Amazon's continued investment in business and services it thinks will yield more sales in the future. Amazon has been particularly focused on expanding its $99 Prime membership, adding new goodies like free same-day shipping in some markets.

Amazon's total revenue in the second quarter rose to $23.185 billion from $19.34 billion a year earlier. On a per-share basis, the company's profit was 19 cents, up from a loss of 27 cents in the year-earlier period.

Analysts had forecast a loss of 13 cents per share on sales of $22.4 billion, according to the average of estimates compiled by Thomson Reuters.

For the third quarter, Amazon said it expects net sales of between $23.3 billion and $25.5 billion, compared with sales of $20.6 billion in last year's period. Analysts, on average, were expecting $23.89 billion.

The company also forecast third-quarter operating income between a loss of $480 million and a gain of $70 million, compared with a loss of $544 million in year-ago third quarter.

Operating expenses for things like package handling, marketing and streaming video content rose to $22.72 billion from $19.36 billion, an indication of Amazon's continued willingness to plow nearly all of its cash back into the business.

Though Amazon faces new competition from startups promising speedy delivery of goods from local stores, as well as new upstart Jet.com Inc., it continues to forge ahead by building new sprawling warehouses in places like Kenosha, Wis. That could help it succeed in getting merchandise to its customers in two days or faster, a potential competitive advantage as it seeks to steal market share from brick-and-mortar retailers.

Write to Greg Bensinger at greg.bensinger@wsj.com

Access Investor Kit for Amazon.com, Inc.

Visit http://www.companyspotlight.com/partner?cp_code=P479&isin=US0231351067

Access Investor Kit for Wal-Mart Stores, Inc.

Visit http://www.companyspotlight.com/partner?cp_code=P479&isin=US9311421039

Subscribe to WSJ: http://online.wsj.com?mod=djnwires

Walmart (NYSE:WMT)
Historical Stock Chart
From Mar 2024 to Apr 2024 Click Here for more Walmart Charts.
Walmart (NYSE:WMT)
Historical Stock Chart
From Apr 2023 to Apr 2024 Click Here for more Walmart Charts.