Revenue from its Amazon Web Services soared 81% to $1.8bn.
Amazon has reported a surprise profit and better-than-expected sales in the second quarter ending 30 June 2015.
The e-commerce firm posted a $92m profit, compared to a $126m loss for the same period last year.
Net sales rose 20% to $23.18bn in Q2, compared to $19.34bn in the year-ago period. Operating income was $464m, compared to an operating loss of $15m in Q2 2014.
The company reported losses in three of the earlier four quarters due to its heavy investments in cloud computing infrastructure, subscription streaming video and other businesses.
Revenue from the company’s Amazon Web Services unit increased 81% to $1.8bn for the quarter, compared to $1bn in the year-ago period.
For the third quarter, Amazon expects net sales of $23.3bn to $25.5bn, up 13% to 24%.
Amazon founder and CEO Jeff Bezos said: "The teams at Amazon have been working hard for customers."
In Q2, Amazon promoted Prime Day by offering special deals to customers who signed up to its fast delivery service. The company said more new members tried it globally than any other day in its history.
Prime Now has been expanded to three additional cities including London, the first international location to offer the service. It is now available in nine cities.
The company launched the Fire HD Kids Edition tablet in the UK and Germany. Amazon has also signed new agreements for new solar and wind farms as part of its plans to achieve 40% renewable energy target in 2016.