Amazon shares have surged more than 18% in after-hours trading after it reported a surprise profit and better-than-expected sales figures.

The online retail giant reported a $92m profit compared to a $126m loss for the same period a year ago.

Sales also rose 20% to $23.2bn in the second quarter to the end of June, boosted by strong growth in the US.

Its shares, which fell 1.3% during the day, leapt 18.5% to $571.24 a share in after-hours trading on Wall Street.

The firm was also upbeat on its prospects for the current third quarter, forecasting sales would grow between 13% and 24% compared to last year, much higher than analysts had predicted.

Sales in North America rose 25.5% to $13.8bn in the second quarter, driven by purchases of electronic goods and general merchandise, helping to drive the strong performance.

Its cloud computing division, Amazon Web Services, also made a contribution, with sales up 81% compared to the same quarter last year.

It said its widely promoted "Prime Day" on 15th July - which offered special deals to customers who signed up to its fast delivery service - had been a success with more new members trying it globally than any other day in the firm's history.

Amazon founder and chief executive Jeff Bezos credited hard work for the results: "The teams at Amazon have been working hard for customers," he said.

Source: BBC