Apple had a tremendous quarter of holiday sales at the end of 2017, as revenue jumped 13% to an all-time record of $88.3 billion and earnings per share rose 16% to $3.89, also a record. Both numbers were slightly better than Wall Street expected.
But amid growing reports of slowing demand for iPhones, Apple also provided a big disappointment to Wall Street in its forecast for sales in early 2018. Expected revenue is $60 billion to $62 billion for the quarter, well below the $65.4 billion average analyst forecast.
At first, it seemed investors’ worst fears had come true. Apple’s shares, which have lost about 7% over the past two weeks, fell another 2% in after-hours trading on Thursday night.
More from FORTUNE
Then CEO Tim Cook and CFO Luca Maestri got on the phone with analysts and turned the whole narrative around. By the time they were done talking, Apple’s stock price had erased the initial loss and gained as much as 4%—a roughly $50 billion swing in market value in less than an hour.
Get Data Sheet, Fortune’s technology newsletter.
The stock gains came as Morgan Stanley’s longtime Apple analyst Katy Huberty challenged Cook and Maestri to explain the softer-than-expected forecast. That prompted the two executives to provide more detail than they typically provide about future iPhone sales.
“Just how should we read into a modest slowdown,” Huberty asked, going on to question whether sales might be slumping due to higher prices or Apple’s recent decision to charge $29 to replace batteries in older iPhones and perhaps prolonging their useful life.
Maestri explained that the forecast didn’t really indicate slower iPhone sales to customers. Each quarter Apple reports in sales how many phones it ships ready for sale. That includes phones shipped but not yet sold being held in inventory. Apple was able to make so many iPhones at the end of 2017 and stash them in inventory that even with continued strong sales, it won’t have to replenish its inventories as much as usual in the beginning of this year. Part of the reason is that the iPhone X didn’t go on sale until November, instead of the usual September sale date, giving the company more time to build up inventory.
“Our guidance for iPhone, we’ve got double-digit year-over-year growth,” Maestri explained, offering a product level of detail not usually disclosed by Apple about its quarterly forecasts. Apple’s $60 billion to $62 billion forecast for total revenue represents 13% to 17% growth from the same quarter last year.
Investors also likely were pleased with Apple’s plans for its vast cash hoard of $285 billion, most of which is stuck overseas but can now be brought back into the country with a lower tax bite. Cook and Maestri said Apple would aim mostly to pay dividends and buy back stock at a pace that would bring the cash level down to about the level of Apple’s $122 billion of debt. “Given the increased financial and operational flexibility from the access to our foreign cash we are targeting to become approximately net cash neutral over time,” Maestri said.
Cook was careful in talking about demand for the iPhone X specifically, however, saying only that it was the best-selling model in the company’s line up. “Since the launch of iPhone X it has been the most popular iPhone every week, every week since and that is even through today, officially through January,” he said. “We feel fantastic about the results.”
Apple’s results appeared to vindicate Cook’s bet on higher prices, as the company not only added the $1,000 iPhone X to its line up in 2017 but also raised prices on both iPhone 8 models compared to the prior year’s line up.
The number of iPhones Apple aapl sold in the holiday quarter actually dipped 1% to 77.3 million. But the average selling price jumped over $100 from last year to almost $800. Net net, iPhone revenue increased 13% to $61.6 billion.
The rest of the smartphone industry wasn’t so fortunate. Overall, fourth quarter phone shipments plunged 9% to 400 million devices, the largest drop in history, according to market tracking firm Strategy Analytics.