James Martin/CNET

Looks like Amazon got its happy holidays after all.

The company on Thursday reported a profit of $214 million, or 45 cents a share, on revenue of $29.33 billion, exceeding some analysts' estimates of 17 cents a share on $29.68 billion in revenue.

The results show that Amazon learned from the mistakes it made last year when its delivery partners FedEx and UPS ended up with a backlog of packages that caused some shipments to arrive at customers' doorsteps after Christmas. This year, the world's largest online retailer revised its delivery plans and even extended its Christmas delivery cutoff date, getting packages to customers on time, said Scot Wingo, CEO of ChannelAdvisor, which provides analytics and other services to online retailers.

For the current quarter, the company said it expects sales to rise to between $20.9 billion and $22.9 billion, growing 6 percent to 16 percent compared with the first quarter last year. It also forecast that operating income would range from a loss of $450 million to a profit of $50 million. Amazon last year reported $146 million in operating income.

Last quarter's profit comes after two consecutive quarters of losses, and investors are buying into the results. Shares surged more than 13 percent in after-hours trading. The stock closed at $311.78, up $7.87, or more than 2 percent.

"They did a really good job of extending the holidays and not repeating the debacle of last year," Wingo said.

Like other retailers, Amazon sees a spike in activity during the season, with big shopping days like Black Friday and, in more recent years, Cyber Monday, driving orders.

The holidays also tend to bump up the company's Prime membership, as people take advantage of the program's free, two-day shipping for last-minute shopping. The company in March hiked the price of Prime membership to $99, up from $79.

"When we raised the price of Prime membership last year, we were confident that customers would continue to find it the best bargain in the history of shopping," Amazon CEO Jeff Bezos said in a statement. "The data is in and customers agree -- on a base of tens of millions, worldwide paid membership grew 53 percent last year -- 50 percent in the U.S. and even a bit faster outside the U.S.

Amazon did not release specific numbers for Prime. Wingo estimated that Prime membership has grown to roughly 40 million.

Prime is a key component of Amazon's strategy. A subscription service that gives members access to e-books, videos and music in addition to two-day shipping, it keeps customer -- and their dollars -- inside Amazon's vast ecosystem. One study of 2014's fourth quarter found that Prime customers spend hundreds more on Amazon than non-Prime shoppers.

"When a customer becomes a Prime member, they do step up their purchases very considerably," Chief Financial Officer Tom Szkutak said during a call with journalists following the report. He would not say how much more Prime members spend or whether they're watching more streaming videos than other consumers. Amazon has heavily invested in its Prime Instant Video service, which Szkutak said is driving more consumers to Prime.

The real star of Amazon's earnings continues to be its cloud-computing arm, Amazon Web Services. The company said that 1 million people use the service now and that it will start breaking out the service's financials this year, an indication of AWS' growth. Amazon has expanded the service considerably since it launched in 2006. It is a major provider of data storage and computing for several consumer brands, including video-streaming service Netflix, and even government entities like the CIA and NASA.

In the past, AWS sales were included in a miscellaneous category for North America sales called "Other," which saw $1.67 billion in sales in the last quarter.

Updated, 2:58 p.m. PT: Added more details from earnings call.

Updated, 3:17 p.m. PT: Updated stock price.