Amazon's profit for the first quarter was $513 million, compared with a $57 million loss in the same period a year ago

Amazon on Thursday reported a fourth consecutive quarterly profit, sending shares surging for the online giant known better for its customer connections than its profit margins.

Profit for the first quarter was $513 million, compared with a $57 million loss in the same period a year ago, and marked a fourth straight quarter in the black for Amazon.

In after-hours trade, Amazon shares leapt 11.6 percent to $672.27 on the news.

Amazon said revenue jumped 28 percent to $29.1 billion in the quarter, as it ramped up its offerings of new tablets, connected home gadgets, online video and grocery delivery, among other things, and boosted its revenues in cloud computing.

The company has also been building loyalty with its Amazon Prime subscription service, which provides access to its online video and music as well as fast delivery for most items.

Amazon has not disclosed sales of its Fire tablets, but research firm IDC estimated it sold 2.2 million in the quarter.

"Amazon devices are the top selling products on Amazon, and customers purchased more than twice as many Fire tablets than first quarter last year," said Jeff Bezos, Amazon founder and chief executive.

He said the company's streaming TV stick, which sells for $39, "became the first product ever from any manufacturer to pass 100,000 customer reviews, including over 62,000 five-star reviews, also more than any other product ever sold on Amazon."

He said the company's artificial intelligence-powered speaker called Echo, designed as hub for a connected home, "is off to an incredible start, and we can't yet manage to keep it in stock despite all efforts."

"We're building premium products at non-premium prices, and we're thrilled so many customers are responding to our approach," Bezos said.

The company's cloud computing service called Amazon Web Services produced $2.6 billion in revenue, up 64 percent from a year ago, and operating income of $604 million.