In the past 10 years, the S&P 500 index has generated a total return of 240%. This means a $10,000 investment in May 2014 would be worth $34,000 today. That's certainly a respectable gain that should please any investor. This broad index of the largest and most profitable U.S.-based companies gets a lot of the attention as it's the most widely followed barometer to assess how the stock market is performing.

However, there's one booming exchange-traded fund (ETF) that beat the S&P 500 in the past and is almost bound to keep doing so over the long term.

A history of outperformance

The Invesco QQQ Trust (QQQ 0.52%) has produced a total return of 460% in the past 10 years, easily crushing the S&P 500's gain. That same $10,000 would leave you with a balance of $56,000 right now. This is a huge gap that we can't ignore. In fact, this outperformance holds true even if we look back over the past three- and five-year periods.

So, you might be wondering just what exactly the QQQ is. It's an ETF that contains the 100 largest non-financial companies that trade on the Nasdaq exchange. Of the stocks in the QQQ, 59% belong in the technology sector, while 18% are from the consumer discretionary sector. It really is an investment vehicle that gives its owners exposure to innovative and disruptive businesses.

It's worth mentioning that the "Magnificent Seven" components hold a huge weight in the QQQ, 43% of the entire ETF's assets to be exact. These industry-leading enterprises benefit from some powerful tailwinds, like cloud computing, digital payments, artificial intelligence, digital advertising, and streaming entertainment.

The composition helps explain why the average business in the QQQ has likely posted annualized revenue growth in the past five or 10 years that's a much faster pace than the typical company in the S&P 500. Higher sales can lead to higher earnings, which can result in rising share prices.

Other factors to consider

It's very easy for investors to believe that past performance will repeat itself. But this isn't always the case. While the QQQ definitely possesses qualities that foreshadow ongoing outperformance, like its tech-heavy focus and higher growth potential, there are other factors that must be considered.

The stocks are more expensive than the average, as shown by the average holding's price-to-earnings ratio of 35. Some less optimistic investors might believe that many of the highly weighted stocks in the QQQ are expensive and that their valuations will come down soon. While that may be the case, I think over very long periods of time, it has proven to be a lucrative bet to focus on some of the most innovative and forward-thinking enterprises.

Plus, with the QQQ, it's not necessary to pick a single winner within a specific technological trend. Owning 100 different stocks provides a broad level of exposure that ensures you can capture the winners.

I also believe macroeconomic factors could play a role. Tech and consumer discretionary stocks typically do well in robust economic environments. With high interest rates and ongoing inflationary pressures, one could argue we are far from this type of favorable setting. Perhaps this means the QQQ's returns in the foreseeable future will disappoint investors.

I'll counter that by saying that the QQQ has actually outperformed the S&P 500 and the Nasdaq Composite since the start of 2023. So, its monster gain has occurred in the face of uncertain macro conditions.

I don't see any compelling reason to believe that the QQQ won't continue beating its more popular benchmark over the next five to 10 years.