It's been a few years since the Nasdaq Composite index (^IXIC 2.02%) last touched a new record. But that changed on the last day of February when the Nasdaq finally broke its 2021 record.

There's no telling where the Nasdaq index goes from here (unless you have a crystal ball handy). However, investors can look at what stocks may have helped drive the index higher for potential clues.

Here are the Nasdaq's main drivers behind this record-breaking stretch:

Nvidia

It shouldn't surprise you that artificial intelligence (AI) chip company Nvidia (NVDA 6.18%) played a big part in the Nasdaq's rise. Nvidia is a heavily weighted stock in the Nasdaq at 5.03%, the index's fourth-highest. The stock is up 240% over the past year compared to the Nasdaq's 40% increase. That massive outperformance combined with heavy weighting helps explain the index's success over the past 12 months.

^IXIC Chart

^IXIC data by YCharts

Nvidia has sported remarkable earnings performance to back up the stock's significant gains, which could help push the index higher as the growth measures are expected to continue. Shares trade at a reasonable forward P/E of 32, considering analysts believe earnings can grow by an average of 34% annually over the long term.

Amazon

E-commerce and cloud leader Amazon (AMZN 3.43%) has also outperformed the index by a wide margin. Shares are up 87% over the past year, more than double the Nasdaq's performance. Amazon carries an even higher weight in the index than Nvidia, approximately 6.45%, the third-largest. That means that Amazon's success directly impacts the broader index's performance.

^IXIC Chart

^IXIC data by YCharts

Amazon is poised to continue riding long-term growth in online retail and cloud computing, especially as AI proliferates over the coming years. The stock could slow down some, though. Shares trade at a forward P/E of 42, which seems fair for a company that analysts expect to grow earnings by an average of 24% annually.

Alphabet

Internet giant Alphabet (GOOG 9.96%) (GOOGL 10.22%) is a sneakily large piece of the Nasdaq Composite because of its dual-share structure. Individually, they would be the fifth and sixth-largest weighted by ticker component. However, if you combined the weighting of Class A and C shares, differentiated by voting rights, Alphabet would replace Amazon as the Nasdaq's third-highest weighting at 6.72%. Shares have outperformed the broader index over the past year, contributing to the Nasdaq's rise.

^IXIC Chart

^IXIC data by YCharts

Although the stock is up over 50% in 12 months, shares are still pretty cheap on a forward earnings basis at 20 times. That's an acceptable price for a company analysts believe will compound its earnings by an average of 16%. Alphabet's core business is digital advertising, which remains a long-term growth trend Alphabet can capitalize on.

Which stocks could rain on the parade?

It's not all good news. The Nasdaq could eventually feel the gravity of its two most heavily weighted stocks, Apple (AAPL -0.35%) and Microsoft (MSFT 1.82%). Together, these two make up 23.8% of the entire index. Apple trailed the index by nearly half over the past year. Microsoft outperformed, like the other "heavyweights" above, with a 65% price appreciation over the past year.

However, both stocks have become quite expensive for their expected growth. Apple is anticipated to grow earnings at a high-single-digit pace but trades at a lofty 27 times forward earnings. Microsoft isn't quite as expensive, but a price/earnings-to-growth (PEG) ratio over 2 isn't cheap. Apple's is over 3. For the PEG ratio, I look for ratios under 1.5 to buy, and anything near 1 or less could be considered very attractive.

AAPL PE Ratio (Forward) Chart

AAPL PE Ratio (Forward) data by YCharts

The potential for these stocks to stagnate or decline due to their valuations remains a threat to the Nasdaq due to their high weightings. It will be fascinating to see how a potential push-pull between the rising and declining stocks shakes out and impacts the index's trajectory.

Investors can make the best of what's to come by deploying a diversified investment strategy, buying stocks with long-term intentions, and buying slowly and regularly to ensure they don't get caught by an unlucky market shift.