Netflix's third-quarter earnings crushed Wall Street's expectations thanks to a surge in subscribers, but the streaming-media giant warned investors that the costs of developing original content will take a bite out of its profit at the end of the year.

Netflix added 6.96 million new subscribers in Q3, well above the 5.3 million new subscribers it reeled in at this time last year and the roughly 5 million expected by analysts.

The better-than-expected subscriber additions, combined with some one-time accounting-related benefits, helped Netflix handily beat Wall Street profit targets. The company posted a profit of 89 cents a share in its most recent period, a full 21 cents a share better than analysts polled by Bloomberg had forecast.

Netflix's stock was up $41.72, or 12%, to $388.12 a share in after-hours trading on Tuesday. Earlier in after-hours exchanges, the stock had been up as much as 15%.

Even as investors cheered the good news, Netflix warned that its per-share earnings in the fourth quarter would be just 23 cents a share — less than half of what Wall Street had predicted. Netflix said its bottom line would be weighed down by having to recognize on its income statement the money it's invested in licensing and developing movies and shows, particularly its "Originals."

"Content companies such as WarnerMedia and Disney/Fox are moving to self-distribute their own content; tech firms like Apple, Amazon and others are investing in premium content to enhance their distribution platforms. Amid these massive competitors on both sides, plus traditional media firms, our job is to make Netflix stand out so that when consumers have free time, they choose to spend it with our service," Netflix said.

Here's what Netflix reported, compared with analysts' forecasts:

Q3 revenue: $4 billion. Analysts were expecting $4 billion also. In the same quarter last year, Netflix pulled in $2.98 billion in sales.

Q3 earnings per share (GAAP): 89 cents. Wall Street was looking for 68 cents a share. In last year's third quarter, it earned 29 cents a share.

Q3 subscriber additions: 6.96 million. In the same period last year, Netflix added 5.3 million subscribers

Revenue, Q4 forecast: Netflix's projects it will post $4.2 billion. Before the report, analysts had predicted it would pull in $4.23 billion. In the fourth quarter last year, Netflix saw sales of $3.29 billion.

Earnings per share, Q4 forecast: The company expects 23 cents. Wall Street had projected it would earn 50.4 cents a share. In the same quarter last year, it posted a profit of 41 cents a share.

Subscriber additions, Q4 forecast: Netflix said it will add 9.4 million. In the holiday period last year, it added 8.33 million.