(New York) CNN Money — Amazon reported a surprise loss of $7 million, or 2 cents per share, for the three months through June.
Wall Street analysts had expected Amazon to earn 5 cents per share in the second quarter.
The loss comes despite the fact that sales at the company continues to soar, rising 22% to $15.7 billion from the same quarter last year. The growth in sales was just shy of analysts' expectations of $15.73 billion.
Amazon's loss stems from costly investments that the company is making. CEO Jeff Bezos' long-term vision for Amazon is to steer it into digital products like the Kindle tablet devices and digital content for its Amazon Prime video streaming service.
"This past quarter, our top 10 selling items worldwide were all digital products Kindles, Kindle Fire HDs, accessories and digital content," Bezos said in a prepared release.
Amazon struck a deal with Viacom in June that gives it exclusive rights to stream TV shows from Nickelodeon, MTV and Comedy Central on its Amazon Prime service.
The company jumped on the opportunity soon after rival Netflix let its own contract with Viacom expire. Netflix currently accounts for 89% of all subscription-based video streams, while Amazon Prime accounts for just 2%, according to the NPD Group.
Amazon has also been spending heavily on making its web services business more secure. Known as cloud services, it is a fast-growing part of the company, where it rents out vast amounts of data storage space to other companies via the Internet.
Amazon shares dropped by almost 2% in after hours trading.
The retail juggernaut has not reported stellar results lately. Thursday's loss follows a 37% drop in profits for the first three months of the year.
Still, investors seem to believe in Bezos' long-term vision because Amazon's stock price has surged 20% this year, topping $300 for the first time on July 11.