(Reuters) - E-commerce company Amazon.com Inc (AMZN.O) on Thursday recorded a surprise profit for the second quarter in a row, propelled by higher sales in North America and its cloud computing business, and its shares rose 11 percent.
Amazon, which has historically struggled with profitability while spending to expand beyond its core online marketplace offerings, reined in costs and was helped to profitability by growth at its Amazon Web Services (AWS) segment.
Chief Financial Officer Brian Olsavsky told reporters on a conference call that the balance between investing and cost controls "will be lumpy over time."
Olsavsky said the company would continue to invest in areas that work with customers, adding that even though investments would "remain very high" Amazon would be looking for ways to cut costs.
Net sales from Amazon Web Services, which has more than 1 million active customers in 190 countries, rose more than 78 percent in the quarter to $2.09 billion.
"There are questions about what's the sustainable margin for this? Are we seeing just a hyper growth phase now? But for right now, AWS is driving the train, and it's going to for the near future," said BGC Partners analyst Colin Gillis.
Analysts on a separate conference call asked Amazon about its forecast for long-term margins on AWS, but the company provided no figures.
Cloud computing is the fastest growing business for Amazon, and the new services in which it is investing, such as Internet of Things, will help the company capitalize on rising demand to store and manage large amounts of information.
Sales in North America, the largest market for the world's biggest retailer, rose 28.3 percent to $15.01 billion in the third quarter ended Sept. 30, on robust Prime Day sales and demand for electronics and general merchandise.
In July, Amazon said customers had ordered 34.4 million items worldwide during the one-day sale for members of its $99 per year Prime subscription service.
The company forecast net sales growth of 14 percent to 25 percent, to a range of $33.50 billion and $36.75 billion, for the holiday shopping quarter.
Analysts, on average, had been expecting revenue of $35.16 billion, according to Thomson Reuters I/B/E/S.
For the latest quarter, Amazon reported a profit of $79 million, or 17 cents per share, compared with a loss of $437 million, or 95 cents per share, a year ago.
Total net sales rose 23.2 percent to $25.36 billion. Analysts, on average, had expected a loss of 13 cents per share on revenue of $24.91 billion, according to Thomson Reuters I/B/E/S.
Amazon's shares rose to $625 in late trade after closing at $563.91 on Thursday.
Reporting by Anya George Tharakan in Bengaluru; Writing by Bernard Orr; Editing by Ted Kerr, Toni Reinhold