Apple sold 77.3 million iPhones in the final months of 2017, slightly fewer than during the same period in the prior year.
But higher prices compensated for the dip, lifting the firm’s profits in the quarter to more than $20bn (£14bn).
The record results, which included strong growth in Japan, were the first to provide a glimpse of sales of the firm’s expensive iPhone X.
Apple boss Tim Cook said iPhone X sales surpassed the firm’s expectations.
Apple released the 10th anniversary phone, which starts at about $1,000, in November. It has been the top-selling phone every week since, Mr Cook said.
Investors had been worried that demand for the firm’s products may be dimming, concerns that appeared to be bolstered by a weaker-than-expected sales forecast for coming months.
The number of iPhones sold in the period also slipped 1% year-on-year, but Apple executives said it was important to remember that the quarter was one week shorter than in 2016.
Quarterly revenue climbed 13% year-on-year to a record $88.3bn.
“I have long believed that a 90-day clock on unit sales is a very surface way to view Apple,” Mr Cook said on a call with financial analysts.
Mr Cook said he is watching figures such as the 1.3 billion active Apple devices around the world, which provide a strong customer base for the firm’s other growing businesses, such as Apple Pay.
Apple has been under a cloud after the firm revealed that it deliberately slowed batteries in older phones, prompting investigations in several countries.
It has since apologised, offering customers cheaper batteries and other modifications, but analysts have said that could reduce replacement purchases, potentially affecting the firm’s bottom line.
Shares climbed more than 3% in after-hours trade.
Analysis: Dave Lee, BBC North America technology reporter, San Francisco
Last year Apple launched three new iPhones, but one was not like the others.
The iPhone X was the main event, the talk of the town. In contrast, the iPhone 8 and 8 Plus felt obsolete before Tim Cook had even finished his presentation. Investors were worried that the presence of the iPhone X would put off people buying the cheaper iPhones. And, given the X started at $999, those people may decide not to buy an iPhone at all.
And that appears to be basically what happened. Apple sold marginally fewer iPhones compared with this time last year (though the company blamed that on a shorter accounting period compared with the same time in 2016).
With the average selling price going up by around $100, to $796, it means Apple may be selling fewer iPhones, but it is making more from each one.
Apple investors will be seeing it like this: selling fewer iPhones but dramatically upping the price is certainly one way to solve that ever-present supply chain headache.
So, a timid quarter by Apple’s unparalleled standards. But by no means a problem.