Uncovering and explaining how our digital world is changing — and changing us.

Amazon’s stock climbed as much as 17 percent in after-hours trading on Thursday as the company posted second-quarter financial results that easily exceeded analyst expectations.

Amazon earned 19 cents a share on $23.2 billion in revenue for the period, easily surpassing estimates of a loss of 14 cents per share on $22.4 billion in revenue.

With the after-market stock move, Amazon’s market value is now north of $250 billion, surpassing Walmart, the world’s largest brick-and-mortar retailer, for the first time.

Revenue in the company’s AWS unit, which sells cloud computing and data storage services, grew 81 percent year over year to $1.8 billion. Amazon first broke out AWS results in the first quarter of this year, when revenue had posted 49 percent year-over-year growth. The division’s operating profit margin was 21 percent for the quarter, up from 17 percent in the first quarter, which at the time was already a pleasant surprise to analysts.

North American revenue grew 26 percent year over year in the second quarter, fueled by the popularity of Amazon Prime and increased product selection in categories such as fashion.

In a call with reporters, new CFO Brian Olsavsky said there is “certainly” a correlation between speeding up delivery, with same-day delivery services such as Prime Now, and increased spending.

“It gets us into the consideration set for more immediate purchases,” he said.

North American operating margin rose to 5 percent in the quarter, up from 3 percent in the same period last year. Olsavsky suggested that the improvement is partly due to Amazon’s opening of product sorting centers closer to city centers, which shortens delivery times and brings down costs.