Amazon Inc. (AMZN) is on a roll. The world's biggest online retailer blew away analyst expectations Thursday with a $513 million profit, its fourth straight profitable quarter, sending its stock up nearly 12 percent after hours on the Nasdaq.

The profit number for the first quarter of 2016 swung from a net loss of $57 million in the same quarter last year and nearly doubled an estimate of $272.6 million, according to analysts polled by Thomson Reuters.

The e-commerce giant posted $29.13 billion in revenue, up by 28 percent from $22.7 billion a year ago, driven by growth in its product sales and cloud computing businesses. Those figures beat analyst expectations of $27.9 billion in revenue. Earnings per share were $1.07, compared with a loss of 12 cents in the same quarter last year.

“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 Amazon founder and CEO Jeff Bezos in a statement. "Echo too 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."

Echo, Amazon's virtual assistant speaker (think Siri but in the form of a large black speaker, not an iPhone), may be proving itself a launchpad into Amazon as a “internet of things” retailer. “We think one area that will garner much more attention from the investment community is the Echo business, and overall strategy to ‘win the connected home,’” Deutsche Bank analyst Ross Sandler wrote in a research note.

Amazon does not break out how many devices it sells, but a report from Consumer Intelligence Research Partners estimates it has sold 3 million Echo devices in the U.S. since it was introduced in late 2014. The device retails at $180, translating to $540 million in revenue.

Amazon's Echo Dot and Tap Amazon launched devices based on its voice-controlled Echo speaker that let users do everything from ordering a pizza to listening to music and changing the temperatures of their home heating systems. Photo: Reuters

Bezos credited sales of Fire tablets and Fire TV set-top boxes with the company’s expectations-beating profits in the third quarter of 2015. Prime subscribers ordered “tens of thousands” of Fire TV Sticks in one hour, which meant it was the fastest deal of an Amazon device ever, outshining the Kindle. 

Additionally, Amazon Web Services has been an important driver of revenue growth to Amazon’s high-spending business. Revenue was up to $2.57 billion, which is up by 64 percent from $1.57 billion in the same quarter of 2015. Bezos previously said AWS would reach $10 billion in revenue this year in its 2015 letter to shareholders.

While AWS faces competition with Apple and Microsoft, analysts have praised Amazon’s offering as a quality product. Indeed, the Panama Papers are hosted on Amazon’s cloud. Netflix, Comcast and NASA, to name a few, also use the service. Amazon is “faster than the competition,” wrote Sandler in a recent research note. Yet he issued caution on the business’s profitability.

AWS has not raised its prices, Amazon's team noted to investors. Therefore, any growth comes from more clients. 

Still, Amazon continues to make other high-spending choices. Investors have been critical of its entry into India, where it faces stiff competition from Indian retailer Flipkart. “We’re inventing things in India that don’t exist in other parts of the country, excuse me, I mean other parts of the world," Amazon’s Chief Financial Officer Brian Olsavsky told investors.

Other international revenue is up for Amazon. It grew $9.57 billion, up from from $7.75 billion. 

What are people buying overseas? "It's the whole array of Prime offerings,” Olsavsky said. “We see it really showing on customer engagement and customer purchases.”

Prime is available in all markets Amazon services, except Mexico, China and India. Prime Now operation for quick delivery is also in in Italy, Japan and UK.

For its current markets, Amazon continues to make a big push for more Prime customers. The company released cheaper Prime memberships, such as a standalone video-streaming service for $8.99 per month, in April. That makes its video subscription just a dollar less than Netflix's.

U.S. customers can also choose to pay $10.99 per month for a Prime membership instead of $99 for a year's subscription.  

This quarter Amazon lost out on a deal to stream "Thursday Night Football" games with the National Football League, a blow to its entertainment ambitions. Twitter secured the non-exclusive rights for less than $10 million, Re/code reported.

Prime is ramping up not only in different price structures, but in new delivery services. Just this week, Amazon introduced Prime Now restaurant delivery to San Francisco and plans to roll it out to more than dozen cities this year. Amazon also operates Prime Now for one-hour delivery of other products in more than 30 cities in the U.S.

Currently Prime Now shipments are made by bicycle carriers, but Amazon has been increasingly building its operations to fulfill other forms of delivery. For instance, Amazon is testing drones called Prime Air that are designed to deliver packages of up to 5 pounds in 30 minutes, or less.

Amazon hopes to ship by air and sea. Amazon is also leasing 20 Boeing 767s so it can begin to operate its own air logistics. Last year, Amazon registered with the Federal Maritime Commission to be an ocean freight operator in the U.S.