Amazon
Amazon is now the world's largest retailer by market valueGetty

Shares in US retail giant Amazon surged a sharp 18% in after-hours trading after it posted a surprise second-quarter profit and exceeded revenue expectations.

Net profit for the three months to the end of June was $92m (£59m, €83m), compared with a $126m loss a year earlier. Revenue jumped 20% to $23.2bn.

Earnings per share for the quarter were $0.19 compared to analyst forecasts for a $0.14 loss.

Amazon also predicted sales to rise between 13% and 24% in the third quarter, far surpassing expectations.

Its stock price soared to $572 in after-hours trading from $482 at market close before easing to $565.

The stock surge drove the online retail firm's market value to around $260bn, making it the world's largest retailer ahead of Walmart, which is valued at approximately $230bn.

Amazon said the "Prime Day" sales event to mark its 20th anniversary on 15 July was a major success, with more new global members trying it than any single day in its history.

Sales in North America jumped 26% to $13.8bn during the quarter while international sales raked in $7.6bn – a modest 3% increase.

Amazon Cloud contributed $1.8bn to sales, an 81% surge from the previous year.

"The teams at Amazon have been working hard for customers," said Jeff Bezos, founder and CEO of Amazon.

"We unveiled Amazon business, opened Amazon Mexico, launched Prime free same-day, rolled out our ninth Prime Now city, broke our Black Friday record with the first-ever Prime Day, received 11 Emmy nominations for Transparent, debuted six new kids pilots, brought Echo to general availability, introduced the Alexa Skills Kit and Alexa Voice Service, opened FBA Small and Light, continued to double down on our fastest growing geography – India, launched 350 significant AWS features and services so far this year, introduced AWS Educate, and entered into agreements for new solar and wind farms – enough to exceed our 2016 goal of 40% renewable energy."