If you want to retire with at least $1 million in your nest egg, then putting a large lump sum of cash into the stock market and simply leaving it there for the long haul could be an excellent plan to achieve that. However, you don't want to put that money into just any kind of an investment.

Even if you think Nvidia is going to continue soaring or that Palantir Technologies will eventually hit a $1 trillion market cap in the near future, for example, investing in individual stocks adds more risk into the equation -- and the fewer baskets your "eggs" are concentrated in, the riskier things get. Matters frequently don't go according to business execs' plans. In just the past five years, there's been a pandemic, widespread supply chain issues, a period of soaring inflation, and now, President Trump's tariffs for companies and investors to worry about. Regardless of what company you're considering, there will be a lot of factors that it has no control over that wind up having drastic effects on its operations.

That's why the safest way to invest for the long term is to hold a diverse mix of stocks. And an easy way to acquire that is by investing in an exchange-traded fund (ETF). If you're looking for one that could maximize your potential gains and focus on top-performing growth stocks, an ideal pick to consider is the Invesco QQQ Trust (QQQ -0.81%). Here's how a $40,000 investment in it today could grow into a position worth $1 million or more in the future.

Person holding many hundred dollar bills.

Image source: Getty Images.

A position in the best Nasdaq stocks

The Invesco QQQ Trust ETF is an attractive option for long-term growth investors because it holds the tech-heavy Nasdaq's top stocks. Specifically, it tracks the Nasdaq-100 index, which includes the largest 100 non-financial stocks on the exchange.

On the one hand, this gives you a lot of diversification -- positions in 100 different stocks. But on the other, it's also not too much diversification, such as you could get from ETFs that hold many hundreds or even thousands of stocks. Excessive diversification is apt to mean more muted gains because no matter how well the highest-performing stocks in a portfolio fare, they won't have much of an impact on a fund's total results if each of them accounts for only a tiny slice of the overall pie. Tracking the Nasdaq-100, however, can provide investors with a great balance. Moreover, because the ETF, like the index it tracks, is market-cap weighted, the biggest companies (many of them tech sector names you'll recognize) account for the largest shares of its value, and thus have the strongest impacts on its returns.

^SPX Chart

^SPX data by YCharts.

Investing is a marathon, not a sprint

Over the past five years, the Invesco QQQ Trust ETF has risen in value by nearly 130%, averaging a compound annual growth rate of approximately 18%, which is far higher than the S&P 500's long-run average of around 10%. Over a longer time frame, however, the fund's growth rate is likely to slow down, simply because of how hot the market has been in recent years and how difficult it is to sustain that high a rate of growth for decades.

But even if you expect an average annualized return that's closer to around 10%, that could still grow a $40,000 investment into a $1 million position, but it will take a bit more time. The table below shows you what your balance could grow into after periods of 30 years or more, based on varying average annual returns.

Year 9% Growth 10% Growth 11% Growth
30 $530,707 $697,976 $915,692
31 $578,471 $767,774 $1,016,418
32 $630,533 $844,551 $1,128,224
33 $687,281 $929,006 $1,252,329
34 $749,136 $1,021,907 $1,390,085
35 $816,559 $1,124,097 $1,542,994
36 $890,049 $1,236,507 $1,712,723
37 $970,153 $1,360,158 $1,901,123
38 $1,057,467 $1,496,174 $2,110,246
39 $1,152,639 $1,645,791 $2,342,374
40 $1,256,377 $1,810,370 $2,600,035

Calculations by author.

It could take approximately 34 years, based on the long-run market average return, for a $40,000 investment today to become worth $1 million. But a lot inevitably depends on that average return, which, unfortunately, is the most difficult variable to account for. It's impossible to reliably forecast what the market's growth rate will be over any time frame at all, let alone decades.

The Invesco ETF is a no-brainer buy for long-term investors

If you plan on keeping your investments in the stock market for at least the next 10 years, then it's easy to justify investing in the Invesco QQQ Trust. While Wall Street will invariably experience periods of short-term volatility, over the longer term, growth stocks as a class are likely to rise significantly in value. And with 100 stocks in the fund, you're also getting some great diversification through just a single investment, making it a solid option to put in your portfolio and just hang on to.