Amazon shares surge 20 percent, market cap surpasses Wal-Mart

Amazon shares spiked in early trading Friday after the online retailer blew past quarterly earnings and revenue estimates, boosted by growth in the North American market and cloud computing segment.

Shares rose 20 percent, giving the retailer a larger market capitalization than bricks-and-mortar behemoth Wal-Mart.

The surge also generated a huge windfall for CEO Jeff Bezos, who owns 83,921,121 shares of the company. At Friday's early prices, his fortune rose some $8.05 billion—a gain that by itself would be enough to put him in the world's 200 richest people.

The company posted second-quarter profit of 19 cents per share on $23.18 billion in revenue. Its sales rose 20 percent from the year-earlier period and were more than $300 million better than the highest of 36 estimates from analysts polled by Thomson Reuters.

Wall Street expected Amazon.com to report a quarterly loss of 14 cents a share on $22.39 billion in revenue, according to consensus estimates from Thomson Reuters. The shares were up as much as 18 percent in extended trading after the results and were tracking well above their all-time high of about $493.

Amazon's operating margin—a metric analysts and investors eyed coming into the report—was 2 percent, compared with 1.1 percent in the first quarter. Operating expenses climbed 17 percent from a year earlier to $22.11 billion.

Read MoreAmazon's CEO Jeff Bezos just made $7B

"The spend that they made from 2010 until now has really started to pay off in a way that's meaningful," said David Seaburg, head of sales trading at Cowen and Company, in a CNBC "Closing Bell" interview.

Jeff Bezos
T. J. Kirkpatrick | Bloomberg | Getty Images
Jeff Bezos

Sales for Amazon Web Services, the company's cloud computing business, rose to $1.82 billion, up 81 percent from a year earlier. Its operating income in the segment rose to $391 million, more than quadrupling from $77 million.

Read MoreAmazon refunds users for eBook antitrust settlement

Still, the key business accounted for only about 8 percent of Amazon's revenue in the quarter. On the company's conference call, CFO Brian Olsavsky said AWS is now in 11 regions and will soon come to India, where the company has ramped up its investment.

Revenue in North America, Amazon's largest segment, rose 26 percent year over year to $13.79 billion. However, the company's international sales grew only 3 percent.

Amazon said it expected net sales of $23.5 billion to $25.5 billion in the third quarter. It projects between a $480 million loss and a $70 million income.

On July 15, the company held its first "Amazon Prime Day" in which it attempted to recreate a Black Friday savings experience in the summer months. Amazon's third-party U.S. same-store sales for that day were about 80 percent ahead of where they were a year earlier by noon, according to e-commerce sales tracker ChannelAdvisor.

Olsavsky said Amazon was "thrilled" by Prime Day.

Read MoreJet v. Amazon: Here is the price war winner so far

—CNBC's Matthew Belvedere, Karma Allen and Zack Guzman contributed to this report.