Amazon has recorded a surprise $7m (£4.56m) loss in its second quarter despite a 22% surge in sales to $15.7bn (£10.2bn) in the period to end of June.

In the same quarter last year the etailer made a profit of $7m.

The loss is equivalent to two cents a share. Analysts had expected the retailer to report a profit of five or six cents a share, according to BBC News.

The retailer is trying to diversify away from simply selling products and to providing a broader range of digital services. It is investing billions in trying to expand into becoming a broader technology company, selling its Kindle tablet range and cloud computing, video streaming and digital downloads.

For the next quarter Amazon’s forecast is below analyst expectations. It predicts a sales increase of between 12% and 24% to between $15.45bn (£10.04bn) and $17.15bn (£11.14bn).

North American sales jumped by 30%, Amazon reported, but its international division saw sales rise by just 13%, and did not make a profit.