After an economically challenging 2022, the stock market has been on a bull run this year. The Nasdaq Composite index has climbed 26% since Jan. 1 as easing inflation and technological advances have made investors bullish. However, many analysts believe the current optimism won't last forever, and the market will start trending down in the coming months as earnings slip from lingering macroeconomic hurdles.

As a result, it's a good idea to use this time to invest in solid growth stocks that are likely to offer gains over the long term, no matter the economic climate. As the leaders of markets such as consumer electronics and e-commerce, Apple (AAPL -1.22%) and Amazon (AMZN -2.56%) are excellent options to fortify your portfolio in uncertain times. 

However, if you are only looking to add one stock right now, you'll need to know the better option. So, let's assess whether Apple or Amazon stock is the better buy. 

Apple 

Apple is a king in the consumer electronics market. The company has proved time and time again its ability to take existing technology and present it in a way that sends user adoption skyrocketing. Apple has done just this with smartphones, Bluetooth headphones, tablets, and smartwatches, achieving a leading market share in each of these sectors. The iPhone maker's dominance in consumer tech has seen its stock soar 272% in the last five years.  

As a result, the company's debut of a totally new product category at its Worldwide Developer Conference on June 5 makes for an exciting time to invest. Apple unveiled its Vision Pro virtual reality/augmented reality (VR/AR) headset at the event. The new device is essentially an entire computer in headset form, meaning it doesn't need to be paired to an external device like a smartphone or computer.

The Vision Pro has taken massive leaps in VR/AR, removing the need for controllers by using advanced eye tracking and hand gestures. People can use the headset for nearly any computing task, from word processing to browsing the web, video editing, FaceTime, and much more. Additionally, the Vision Pro provides immersive entertainment experiences for everything from movies to gaming, watching sports, and more. 

While many tech enthusiasts are excited about the new product, Wall Street seems unsure what to make of it primarily because of its eye-watering price of about $3,500. The high price point means the Vision Pro is not accessible to the average consumer just yet. As a result, an investment in Apple is for what this product can become a few generations down the line when cheaper options become available to the masses. 

However, considering the AR market is projected to hit $461 billion at a compound annual growth rate of 42% through 2030, Apple is well-positioned to profit substantially from the expanding industry.

Amazon

Amazon shares have risen 49% year to date as its e-commerce business has shown signs of rebounding after significant losses last year. The company's e-commerce segments reported a combined $10.6 billion in operating losses in fiscal 2022 as economic declines curbed consumer spending. However, investors were able to breathe a sigh of relief in Amazon's first quarter of 2023, with its North American segment returning to profitability and its international retail business reporting a slight improvement. 

The retail giant looks to be back on a growth path as inflation eases, and it has more to gain than most as the situation improves. Amazon holds a leading 38% market share in e-commerce, which could lead to a massive boost in revenue as the market recovers. Meanwhile, improving interest rates will likely allow businesses to increase cloud spending, bolstering the company's cloud platform, Amazon Web Services. 

Amazon's potential is evident in its average 12-month price target of $138, which projects stock growth of 10%. The figure aligns with the company's five-year stock gains of 48%, making Amazon an attractive long-term option.

Is Apple or Amazon stock the better buy?

The choice between Amazon or Apple stock comes down to which is the more reliable buy ahead of potential economic challenges. In this case, Apple is the clear winner. Amid a sell-off in 2022, Amazon's stock fell 50% while Apple's declined a more moderate 27%. The maker of MacBooks and iPhones is home to a more resilient business thanks to consistent product demand. 

Moreover, Apple's price-to-earnings ratio of 30 compared to Amazon's 299 makes its stock a far bigger bargain. So if you're looking for value and reliability in the retail sector, Apple's stock is an attractive option this month.