Amazon has surprised market analysts by posting a second quarterly profit in a row.

The world's largest retailer, which has notoriously struggled to turn a profit over the years, posted profits of $79 million (£51.3m), compared with a loss of nearly $350m in the same period last year.

Amazon said higher sales in the US and its its Amazon Web Services business had helped to drive the surprise profit. Net sales were up 25% to $25.36bn, with US sales rising 28.3% to $15.01bn.

In the second quarter, Amazon posted its first big surprise with a profit of $92m. It could even report a third consecutive profit for the fourth quarter after predicting a 14-25% rise in sales over the Christmas period.