Shares of Apple (AAPL -1.22%) soared 255% over the past five years, more than doubling the Nasdaq's return. Most investors attribute that growth to the popularity of the iPhone and iPad.

However, investors shouldn't overlook Apple's sustainable competitive advantages -- the long-term strengths that give it a lasting edge over its rivals. Let's discuss two of those key strengths -- a protected ecosystem and brand appeal -- which should keep Apple ahead of its rivals for the foreseeable future.

Exterior of Apple Store in Milan, Italy

Image source: Getty Images.

A protected ecosystem
Only Apple devices run iOS. By comparison, multiple manufacturers produce devices that use Google (GOOG -1.10%) (GOOGL -1.23%) Android.

This means that if customers want to remain within Apple's ecosystem and keep their digital purchases, they must continue buying iOS devices. Last year, a survey by Simonlycontracts.co.uk found that 78% of iPhone owners "couldn't imagine" owning a different phone, while 59% confessed a "blind loyalty" to Apple. Therefore, as iPhone sales keep rising, more new users will be "locked" inside Apple's walled garden.

iPhone sales, by year. Source: Compiled by author.

Android users, however, can easily switch between Samsung, HTC, and Sony smartphones since their Google accounts follow them across Android devices.

Meanwhile, the average price of Android devices fell due to two reasons. First, any company can develop and sell Android smartphones, since the OS is free and open-source. Second, chipmakers such as Qualcomm and Intel are helping those companies launch smartphones quickly with "turnkey" reference designs. As a result, premium Android device makers including Samsung, HTC, and Sony have lost market share to low-priced rivals.

The commoditization of the Android market resulted in hardware fragmentation. This makes it more challenging to develop Android apps, which must be tested on a wider variety of hardware than their iOS counterparts. It also makes it tough for Google to keep all its users on the same page with new features, considering that less than 10% of all Android devices run the latest version, Lollipop. By comparison, 82% of iOS devices have already been updated to iOS 8.

Attempts to duplicate Apple's walled ecosystem strategy have all fallen short of expectations. Samsung tried to establish a closed ecosystem with Tizen, but the OS has only been installed on wearable devices, smarthome appliances, and a single smartphone.

Brand appeal
Meanwhile, Apple is also one of the few electronics brands to be considered a luxury brand.

The Hurun Research Institute reported that Apple was the top luxury brand for gifting among China's richest men and women in 2014, beating brands including Louis Vuitton, Prada, Cartier, and Chanel. Samsung, the only other electronics manufacturer in the top 10, ranked 10th among men and ninth among women.

Just as Louis Vuitton can charge hefty premiums on leather handbags, Apple can sell fairly average hardware at premium prices. A comparison between the iPhone 6, Samsung's Galaxy S6, and HTC's One M9 reveals just how average Apple's flagship device is.

 

Display

CPU

RAM

Cameras

Battery

iPhone 6

4.7" IPS LCD, 326 ppi

Dual-core 1.5Ghz

1GB

8MP/1.2MP

1810 mAh

Galaxy S6

5.1" Super AMOLED, 577 ppi

Quad-core 1.5Ghz + Quad-core 2.1Ghz

3GB

16MP/5MP

2550 mAh

One M9

5" Super LCD3, 441 ppi

Quad-core 1.5Ghz + Quad-core 2Ghz

3GB

20.7MP/4MP

2840 mAh

Source: GSMArena.com.

Despite its lower-end specs, the 16GB version of the iPhone 6 costs $649, the same price as a 32GB One M9 or a 32GB Galaxy S6. Therefore, Apple can sell its phones at beefier margins and higher sales volumes than its Android-powered rivals. Based on IHS teardown costs, the base model of the S6 costs $275.50 to produce, compared to a bill of materials of $228 for the iPhone 6.

Unless Apple's rivals can match its brand appeal in the high-end market, they can't match that strategy of selling devices with cheaper components inside. However, Apple has such a head start in the luxury market that Samsung, Sony, HTC, and others are unlikely to close the gap anytime soon.

The key takeaways
Despite those strengths, investors should recognize Apple's biggest weakness -- its heavy dependence on the iPhone, which accounted for nearly 70% of the company's top line last quarter. If competition or market saturation ever cause iPhone sales to slip before Apple can properly diversify its top line, the stock will take a big hit. But I believe Apple's well-protected ecosystem and lack of meaningful competition in the premium market should keep iPhone sales humming along nicely for at least a few more years.