Shares of the company rose 1.6 percent to $223.59 in after-hours trading.
Second-quarter revenue was $12.83 billion, up 29 percent from a year earlier.
Amazon's product revenue, which includes its traditional online retail business, grew 25 percent to $10.79 billion.
Amazon's services revenue, which includes its online marketplace for third-party merchants and its cloud computing business Amazon Web Services, surged 57 percent to $2.04 billion.
These newer businesses are more profitable than Amazon's retail operations, so as they become a larger part of the company, overall profit margins grow.
Amazon's gross profit margin was 26.1 percent in the second quarter, up from 24.1 percent a year earlier, according to Scott Tilghman, an analyst at Caris & Co.
"There was tremendous growth in Amazon's higher-margin services," Tilghman said. "I can't find a quarter in the past nine years when Amazon's gross margin was over 26 percent."
Net income was $7 million, or one cent per share, versus $191 million, or 41 cents a share, a year earlier, the company said.
Amazon forecast third-quarter revenue of $12.9 billion to $14.3 billion. Analysts were forecasting $14.1 billion, according to Thomson Reuters I/B/E/S.
Amazon also forecast a third-quarter operating loss of $50 million to $350 million. Excluding stock-based compensation and other items, the forecast was between a loss of $75 million and a profit of $225 million.
Analysts at JP Morgan, Raymond James and Caris & Co were looking for third-quarter operating profit of $258 million, $280 million and $388 million respectively. Those forecasts excluded stock-based compensation and other items.
"The real story here is around guidance - it was a little bit light from what people were expecting and the bottom line much lower than what people would have expected," said Needham and Co analyst Kerry Rice.
"They're going to spend to build the infrastructure and capacity to deliver the products and services that they feel the consumer wants," he added. "I don't know that we can say they are investing or spending too much. It's certainly more than people expected."
Copyright Thomson Reuters 2012