Apple (AAPL -2.88%) shares have skyrocketed roughly 140,000% since the company first went public in 1980. The tech giant has achieved the highest market cap in the world, surpassing $3 trillion earlier this year. Apple's success over the years has come thanks to its priority on quality products, offered alongside an easy-to-use design language.

This consistency has led to immense brand loyalty from consumers who would rather pay a premium for Apple products than turn to the competition. As a result, it's not a bad idea to consider adding Apple to your list of holdings.

Its massive stock growth over the years could indicate that the best time to invest in the iPhone manufacturer was long ago. However, leading market shares in multiple areas of consumer tech and expansions into new sectors suggest the company isn't done yet.

Here's why it's not too late to buy Apple stock.

The most to gain from a market recovery

Apple released its third quarter of 2023 earnings on Aug. 02, with macroeconomic headwinds causing declines across its product lineup. Its iPhone revenue slipped 2% year over year, Mac tumbled 7%, and iPad fell 20%. The period represented Apple's third-consecutive quarter of revenue declines, falling 1% to $82 billion.

The bright spot of the quarter was services, which rose 8% year over year and proved how lucrative the subscription-based business has become for the company.

Despite the challenging quarter, Apple has much to gain from easing inflation and the market's inevitable recovery. The tech company holds a 55% market share in smartphones, with similar dominance in tablets, smartwatches, and headphones. With leading shares across consumer tech, the company could benefit the most as spending rises alongside improving economic conditions.

Moreover, the company has proved its strength by performing better than the competition amid an economic downturn. For instance, in Q2 2023, iPhone sales fell 6%. However, the same period saw Samsung smartphone sales decline 37%, with Motorola's slipping 17%. Apple's resilience makes its stock a reliable long-term option.

Apple is investing heavily in generative AI

Artificial intelligence (AI) has been one of the biggest growth drivers in the stock market this year, with companies such as Amazon and Nvidia enjoying rallies of 66% and 217% since Jan. 1 based on their growing prospects in the sector. Consequently, countless companies have joined the industry, which is projected to expand at a compound annual growth of 37% through 2030. Apple has largely stayed away from the hype of AI this year. However, recent reports suggest the company could make a big splash in the industry in the coming years.

In Q3 2023, Apple spent about $23 billion on research and development, up by about $3 billion from the previous year. CEO Tim Cook told Reuters on Aug. 4 the increase was mainly driven by the company's expansion in generative AI. The news comes only weeks after Bloomberg reported the iPhone company had built a custom framework for creating large-language models and has developed its own version of OpenAI's ChatGPT that engineers call Apple GPT.

Apple is slightly late to the AI party compared to companies like Microsoft and Amazon. However, its nearly unrivaled dominance in consumer tech products could see it become the leading driver of AI adoption for the public. Its immensely popular products are an excellent tool to get its AI offerings into the hands of millions of consumers and grant it a solid position in the industry.

Apple's stock has risen almost 250% in the last five years, more than big tech companies such as Microsoft, Amazon, or Alphabet. The iPhone manufacturer has a history of offering investors consistent gains, with its market dominance making it one of the most reliable long-term investments available. Alongside a growing position in AI, it's not too late to benefit from Apple's solid outlook over the next five and ten years.