For Amazon, Prime is the gift that keeps on giving.
The company's $99-a-year membership service, which offers unlimited two-day deliveries and other perks, helped contribute to a surprise profit for the three months ended June 30.
"We are getting very good top line growth," Amazon finance chief Brian Olsavsky said on a call with analysts Thursday. "A lot of that is fueled by Prime, Prime adoption and we're dropping a lot of it to the bottom line."
Investors clearly liked the results. Shares -- already up 55 percent this year -- surged 17 percent in after hours trading. That late-day burst pushed Amazon's market value above that of Walmart, the world's largest retailer.
For Amazon's second quarter, North America operating profit more than doubled to $703 million, thanks in part to Prime. Meanwhile, Amazon Web Services -- its fast-growing and highly profitable business that rents out datacenter space to other companies -- reported $391 million in operating income, surging from $77 million a year ago. Those two segments combined to help Amazon pull off a profitable quarter.
Amazon for years has been driving up expenses and forgoing profit in the pursuit of growth. Investors punished Amazon's stock last year for its seemingly endless spending spree. Despite that, Amazon continued to woo Prime customers with new offerings, including the new Prime Now rapid-delivery service in some markets for its members. It's also growing its Home Services program, which connects customers with handymen, plumbers and electricians, as the company hopes to build up a reputation selling services, not just goods.
The spending this time around didn't outpace Amazon's sales. The company Thursday reported profit of $92 million, or 19 cents a share, on $23.2 billion in revenue. That blows away analysts' estimates of a 14-cent loss on $22.4 billion in revenue. Amazon last year had a loss of $126 million, or 27 cents a share, on $19.3 billion in sales.
While Amazon remains the top dog in online retail, it's facing a new crop of challengers that want to replicate its successful Prime membership service. Walmart is experimenting with a three-day shipping program called ShippingPass and newcomer Jet.com this week launched its new buyers club website. Both charge $50 a year, compared with $99 for Prime membership.
The latest results come about a week after Amazon celebrated its 20th anniversary by throwing a big sale it called Prime Day. The event was a big success for the company, helping it sell loads of items and bringing in hundreds of thousands of new customers to its Prime membership program. Even so, the sale was not without its problems, including a wave of customers taking to social media to complain the sale was a let down and claiming Amazon was simply trying to sell off its unwanted merchandise. Despite that snag, Amazon said it plans to offer Prime Day again.
Factoring Prime Day into its guidance for the current quarter, Amazon predicted operating income to come in between a loss of $480 million and a profit of $70 million, compared with a $544 million loss last year. Sales are expected to be $23.3 billion to $25.5 billion, mostly ahead of analysts' estimates of $23.8 billion.
Updated, 3:45 p.m. PT: Added executive comment and guidance.