Amazon beat first-quarter 2016 expectations in dramatic fashion, with the diversified e-commerce company reporting revenue up 28% to $29.1 billion and earnings far above Wall Street estimates.

Net income was $513 million in Q1, or $1.07 per diluted share, compared with a net loss of $57 million a year ago. It was Amazon’s fourth straight quarterly profit. Analysts had expected the e-commerce Goliath to report $27.9 billion in revenue and EPS of 58 cents.

Amazon shares spiked more than 12% in after-hours trading Thursday. The company’s results were driven by a surge in its Amazon Web Services business: The cloud computing unit had sales of $2.57 billion (up $1 billion, or 64%, year-over-year) and operating profit tripled, to $604 million.

On the streaming-video front, the company highlighted recent movie acquisitions by Amazon Studios. The company acquired rights to films including Woody Allen’s “Café Society,” Whit Stillman’s “Love & Friendship,” and 2016 Sundance Film Festival titles “Manchester by the Sea,” “Gleason,” “Author: The JT Leroy Story” and “Wiener-Dog.” Following its theatrical run, each film will become available exclusively to Prime members through Prime Video.

Amazon doesn’t break out spending on content, but CFO Brian Olsavsky said the company’s earnings call that investment in Prime is projected to increase over the next several quarters.

“Beyond the awards that the (Amazon Studios) content is winning and the success we’re having with Amazon, particularly our Amazon originals, we feel that program is working,” Olsavsky said. “We’re going to significantly increase our spend in that area. Some of that is in Q2; you’ll see that more in the next few quarters.”

Amazon’s spending on original content, including TV programming, positions it as a bigger rival to Netflix. Last week, Amazon took a big step to make the Prime Video service directly competitive with the No. 1 streaming service by offering Prime Video as a standalone subscription for $8.99 per month in the U.S. Previously, Amazon’s streaming service was available only to members of the full Prime program for $99 annually.

Also in the first quarter, Amazon launched “Style Code Live,” a daily live show dedicated to fashion and beauty that incorporates shopping and interactive features like live chat. “Style Code Live” is hosted by Lyndsey Rodrigues, Rachel Smith and Frankie Grande, and has featured guests including Meghan Trainor and Molly Sims. The show streams free for all viewers weeknights at 9 p.m. Eastern.

In addition, the company called out Amazon Studios’ “Just Add Magic,” its second original live-action kids’ series, as the most successful original children’s programming premiere with the highest number of streams and hours in the first weekend.

The company also boasted about its devices business. In announcing the results, founder and CEO Jeff Bezos said Amazon devices are the top-selling products on site, and customers purchased more than twice as many Fire tablets in Q1 than in the first quarter of 2015.

Earlier this week, the $39 Fire TV Stick became the first product ever on Amazon — from any manufacturer — to pass 100,000 customer reviews, including over 62,000 five-star reviews, also a record. “We’re building premium products at non-premium prices, and we’re thrilled so many customers are responding to our approach,” Bezos said in prepared remarks.