Megacap growth stocks sold off big time in 2022 before staging a massive recovery the following year. The rebound was led by household names, including Microsoft, Apple (AAPL -2.88%), Nvidia, Alphabet, Amazon, Meta Platforms, and Tesla (TSLA -0.33%) -- a group known as the "Magnificent Seven."

Apple and Tesla had a slow start to 2024, though. At one point, Tesla was the worst-performing stock in the S&P 500. However, the narrative has completely changed. Besides Nvidia, Tesla and Apple have been the best-performing Magnificent Seven stocks over the last three months.

Now that these laggards have joined the party, the Magnificent Seven are universally back in favor. Here's what's driving Apple and Tesla higher and how to approach investing in the Magnificent Seven now.

Shifting sentiment

The recent moves in Tesla and Apple are a reminder of the impact market sentiment can have, especially on short-term price action. Tesla surged 10.2% on July 2 and 6.5% on July 3, adding to its 11.1% rally in June. Its second-quarter delivery figures exceeded expectations but were still 5% lower year over year.

Tesla stock started 2024 with heavy losses due to fears that demand for electric vehicles (EV) was slowing, while its artificial intelligence (AI) ambitions also came into question. Unlike other megacap growth stocks that are monetizing AI -- like Nvidia and Meta Platforms -- Tesla's robotaxi opportunity remains unproven as its full self-driving technology still requires a human behind the wheel.

Competition, both within the EV space and from hybrid vehicles made by legacy automakers like Toyota, poses a serious threat to pure-play EV companies. And consumer spending on discretionary goods remains under pressure in today's high-interest-rate environment. Delaying a new car purchase may be one of the first budget cuts that households make to offset higher costs.

These challenges haven't disappeared, but the sentiment has certainly shifted in Tesla's favor.

Apple is in a somewhat similar boat. Growth has ground to a halt with iPhone sales remaining pressured in China. Earlier this year, Apple failed to impress investors with its new product offerings, and there were concerns that new iPhones wouldn't have the AI capabilities the market hoped for. That sentiment changed in June during Apple's annual Worldwide Developers Conference, where it announced AI integration across several key product categories.

Prior to the rebound, Apple had become the cheapest Magnificent Seven stock. A languishing stock price and buyback-fueled earnings-per-share growth made the stock a good all-around value. Still, its services segment was strong, and investments in research and development had yet to pay off. The recent surge in Apple stock has brought its returns this year closer in line with the rest of the Magnificent Seven.

NVDA Chart

Data by YCharts.

Filtering out the noise

The best way to grow wealth in the stock market is to buy a company you believe in at a good price and hold it long term. You've probably heard some version of this strategy countless times. However, it's much harder to implement in practice.

There are always good arguments for owning or not owning a stock. And sometimes, the negatives can ring out louder than the positives. It happened to most of the Magnificent Seven stocks in 2022.

Earlier this year, some investors questioned Alphabet's search engine domination in a world of ChatGPT and other unknown threats. In late 2022, Meta Platforms fell under $100 per share as TikTok threatened its flagship app Instagram and the company was heavily criticized for blowing money on unproven bets and buying back its stock at a lofty price. Today, Meta Platforms trades for over $500 per share.

The bull and bear cases never go away, but the pendulum can swing heavily toward one or the other. And right now, investors may be teetering on the brink of euphoria, but that doesn't mean it's necessarily a good idea to sell shares of Magnificent Seven stocks and run for the exits.

The challenge with selling a great company just because it looks expensive is that you have to then identify when to get back into the stock. Timing the market rarely works because you have to sell and buy at the right time, whereas buying and holding only requires you to make one good decision -- investing in a company that can compound earnings over time.

A diversified way to invest in the Magnificent Seven

There are plenty of ways for investors to put new capital to work in the Magnificent Seven. One of the simplest methods is to invest in a low-cost S&P 500 exchange-traded fund (ETF).

The Vanguard S&P 500 ETF (VOO -0.57%) has just a 0.03% expense ratio and over $1.1 trillion in net assets. As of July 9, the total market cap of the S&P 500 was $46.8 trillion, while the cumulative market cap of the Magnificent Seven was $16.7 trillion -- or 35.8% of the entire index. That means every dollar invested in the S&P 500 is equivalent to putting $0.36 in the Magnificent Seven and $0.64 in the rest of the market.

A even more aggressive approach would be to invest in the Vanguard Growth ETF (VUG -0.96%), Vanguard S&P 500 Growth ETF (VOOG -0.64%), or the Vanguard Mega Cap Growth ETF (MGK -1.04%) -- all of which have higher concentrations in the Magnificent Seven than the S&P 500.

Let the Magnificent Seven work for you

Ultimately, the best way to approach the Magnificent Seven will depend on what you already own, your risk tolerance, and what themes you want to increase your exposure to. For example, if you already have substantial exposure to software stocks, it may not make sense to put additional funds into Microsoft. Or if you believe Amazon Web Services will continue to dominate cloud infrastructure, you may be less interested in Microsoft Azure or Google Cloud.

If you're looking for a balanced approach, consider one of the above Vanguard ETFs. They provide an inexpensive way to spread risk across the Magnificent Seven while still gaining exposure to other pockets of the market.