Various app icons from Apple's App Store

Image source: Apple.

Much has been made of Apple's (AAPL -1.22%) services revenue over the last year or so. After it was clear Apple would struggle to continue growing iPhone sales following the outstanding success of the iPhone 6, CEO Tim Cook commented that a "growing portion of our revenue is directly driven by our existing install base." That is, sales of apps, content, iCloud, Apple Care, and other Apple Services will account for an outsized portion of Apple's revenue growth going forward.

To be clear, Apple is still very much a hardware company. Apple's services revenue accounted for just 11% of Apple's total sales in fiscal 2016. The iPhone, by comparison, made up 63% of revenue. But services revenue grew 22% last year, faster than any other segment.

With stalling hardware sales growth, investors may be wondering if growing services revenue is enough to move the needle on Apple's bottom line.

All about the margins

Despite its relatively small size, Apple's services business generates higher margins than its hardware sales. That's simply the nature of software, which sees wider margins as products reach scale. And very few companies have the scale of Apple; the company has over 1 billion devices in use.

Apple's App Store sales have a gross margin of about 90%, according to estimates from Macquarie Securities analyst Ben Schachter. Overall, he estimates the rest of Apple's services have a gross margin of 65%. That means Apple's services revenue has a gross margin about twice as large as its hardware sales.

Importantly, the App Store -- Apple's highest-margin product -- is one of the fastest-growing pieces of Apple's services. Last year, App Store revenue climbed over 33%. Schachter expects it to climb 28% on average over the next five years while non-App Store services grow just 10% annually. That means Apple's services margin will continue to expand.

How it all impacts Apple's gross profit

Even if hardware sales remain flat, that won't prevent Apple from expanding its install base. As Cook mentioned in the company's first-quarter earnings call last year, "Because of the enduring value of the device, their replacing is likely higher to be given or sold to someone who will also love and use it often." In other words, even if Apple isn't selling more devices directly to consumers, the user base can grow through third-party resales or gifting.

A growing user base combined with growing service sales per unit ought to continue driving revenue growth for the segment for several more years.

A dollar in sales growth from services will carry twice the gross profit, on average, as a dollar in sales growth of Apple's hardware. So, even though services is a relatively small business right now, it outpunches its weight class, providing approximately 21% of gross profits in 2016. That number is set to expand as more of Apple's sales growth comes from services.

As an illustration of the impact of Apple's service revenue growth, a 20% increase in services revenue in fiscal 2017 would result in about a 4% increase in the company's total gross profit and a 70 basis point expansion in gross margin if all else remains equal. Considering the size of Apple, that's pretty significant growth. Schachter estimates Apple's gross margin will expand as much as 400 basis points over the next five years.

Gross margin expansion combined with modest revenue growth and share buybacks should continue to boost Apple's earnings per share at a fairly steady pace. Analysts expect 13.8% EPS growth over the next five years, but there could be even more upside depending on how much margins expand. With shares trading at a price-to-earnings ratio of just 14.4, shares may still be undervalued if Apple can maintain hardware sales and continue growing services revenue as expected.