On Tuesday, Apple (AAPL -0.57%) reported a second consecutive quarter of double-digit declines in revenue and earnings. However, the results outpaced the midpoint of Apple's April guidance and were also better than what analysts had expected.

Apple hasn't lost its mojo -- notwithstanding skeptics' claims to the contrary. Image source: The Motley Fool.

Even more importantly, Apple achieved these results while dramatically reducing its channel inventory. This means underlying demand for Apple's products was much better than the numbers in the earnings release would imply. Furthermore, Apple expects demand trends to remain solid going forward.

Apple bests expectations

Apple's revenue fell 15% year over year last quarter, from $49.6 billion to $42.4 billion. This was still a tad better than the average analyst estimate of $42.2 billion.

The drop was driven entirely by the iPhone, Apple's top-selling product by far. iPhone unit sales declined 15% year over year to 40.4 million. Analysts had expected Apple to sell about 40 million iPhones.

iPhone revenue declined at an even faster 23% rate. The iPhone's average selling price plunged nearly 10% year over year, from $660 to $595, largely because of the introduction -- and strong sales -- of the new, lower-priced iPhone SE. The strong dollar also likely contributed somewhat to the ASP decline.

Meanwhile, Apple's earnings per share slumped 23%, falling to $1.42 from $1.85 a year earlier, but edging ahead of the analyst consensus of $1.40. Gross margin reached the high end of Apple's guidance range at 38%.

Underlying demand was even better

Earlier this year, Apple decided it should take a more conservative approach to inventory management because of macroeconomic weakness and slowing sales in many markets. As a result, Apple executives warned investors that the company's Q3 results would be negatively impacted by channel inventory reductions.

Apple significantly reduced its channel inventory in Q3 -- especially for the iPhone 6s. Image source: Apple.

On Apple's April earnings call, CFO Luca Maestri stated that the company planned to reduce its channel inventory by more than $2 billion during the third quarter. By contrast, it reduced channel inventory by less than $800 million in Q3 of the 2015 fiscal year.

However, Apple ultimately reduced its channel inventory by a stunning $3.6 billion during the quarter. Thus, if Apple had stuck to its original plan for channel inventory, its revenue would have been about $1.5 billion higher, blowing by both top-line and bottom-line expectations.

Apple's channel inventory reductions had the effect of downplaying demand for the company's products. For example, Apple reduced iPhone channel inventory by more than 4 million units. So, while the company reported a 15% year-over-year decline in iPhone unit sales, sell-through to end users was down just 8% from a year earlier.

Good news for the coming quarter -- and year

With channel inventory now very lean, Apple is poised to deliver better results going forward. The company expects revenue of $45.5 billion to $47.5 billion in Q4, which would represent a year-over-year decline of just under 10% at the midpoint.

Even this relatively solid guidance may prove conservative, depending on when Apple starts to sell the next-generation iPhone. After all, on a sell-through basis, Apple's revenue was down a little less than 10% in Q3, and the year-over-year revenue comparisons will be easier in Q4. Furthermore, upgrade demand should improve once the next-generation iPhone arrives.

Most importantly, analysts' estimates for the upcoming 2017 fiscal year seem too low based on the underlying demand trends at Apple. Even if the iPhone 7 doesn't offer any revolutionary new features, it's likely to stimulate more upgrade demand than the iPhone 6s product cycle did. This should drive a much greater revenue rebound than the modest 3.7% uptick analysts currently expect.

As investors start to recognize that the outlook for Apple is better than feared, Apple stock should start to regain some of the ground it has lost in the past year.