Amazon.com Inc reported a surge in quarterly revenue on sales of its kindle electronic reader and other electronics and forecast far better-than-expected revenue for the current quarter, sending its shares up more than 6 percent.

The largest Internet retailer benefited from growth in e-commerce, though margins continued to be pressured by heavy spending on distribution, technology and digital content.

But the market focused more on sales growth than profits.

If you look at top-line growth it was extremely strong, Dan Geiman, analyst at McAdams Wright Ragen, said. At this point it's a question of how long the company is going to continue to invest at their current levels. Presuming these investments don't go on forever, earnings should grow going forward.

The world's largest web retailer reported a 51 percent climb in revenue to $9.91 billion, surpassing Wall Street's expectations for $9.4 billion.

Operating margin fell to 2.0 percent from 4.1 percent a year earlier.

Amazon is investing heavily to build warehouses and distribution to support its main e-commerce business. It is also spending on servers and datacenters for its cloud computing business, Amazon Web Services, while buying more digital content to bolster media offerings such as streaming video.

The company is expected to introduce a tablet computer later this year that would compete with Apple Inc's iPad.

Amazon forecast third-quarter sales of $10.3 billion to $11.1 billion, compared with the average forecast for $10.35 billion, according to Thomson Reuters I/B/E/S.

Operating income is expected to be between $20 million and $170 million in the period, the company also estimated. The guidance includes about $180 million of stock-based compensation expense and amortization of intangible assets. It also assumes no other acquisitions or investments close in the quarter.

Shares of the company, which have risen about 18 percent since the start of 2011, gained 6.3 percent to $227.57 in after-hours trade.

Second-quarter net income came in at $191 million, or 41 cents per share, versus $207 million, or 45 cents per share, in the same period a year earlier. Analysts expected 35 cents per share for the latest second quarter, according to Thomson Reuters I/B/E/S.

Sales in Worldwide Electronics and Other General Merchandise, which includes sales of the Kindle e-reader, computers, cameras and other consumer electronics, jumped 69 percent to $5.89 billion in the second quarter.

Excluding currency fluctuations, sales rose 62 percent.

That's very strong, said Scot Wingo, chief executive of ChannelAdvisor, a software provider that helps retailers sell more online through channels including Amazon and eBay Inc.

E-commerce in general is growing at 10 percent to 14 percent, so Amazon continues to gobble up market share. Wingo owns Amazon shares and eBay is an investor in ChannelAdvisor.

Amazon shares have climbed this year as investors are betting the company will benefit as more shopping moves online from traditional retail outlets.

E-commerce sales represent just 6.3 percent of total retail sales, but that may climb to 30 percent in the next five to 10 years, according to a survey this week by investment bank Piper Jaffray.

(Writing by Brad Dorfman, additional reporting by Eunju Lie in Chicago, Noel Randewich in San Francisco; editing by Bernard Orr)