Amazon.com Inc reported a surge in quarterly revenue and said revenue for the current quarter would be better than expected, 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 reaction 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 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.

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.

(Writing by Brad Dorfman, editing by Bernard Orr)