The S&P 500 (^GSPC -1.54%) hit another record last week when it topped 5,300 and kept climbing. It's up more than 11% this year on investor confidence in the economy and the Federal Reserve holding interest rates steady.

It's not easy to beat the market over time, so it makes sense to invest some portion of your savings in an exchange-traded fund (ETF) that tracks it. The S&P 500 has been a wealth-building machine for decades, roughly doubling over the past five years. Can it double again by 2030?

Waxes, wanes, and patterns

The S&P 500 has doubled over the past five years and gained close to 400% over the past 20 years.  

Over that time period, there have been only three years where more than half of large-cap mutual funds beat the market. Even then, it was a slim majority, with 55% the highest level of market-beating funds in 2007, right before the market crashed.

That's a pretty strong track record, although there's never any guarantee for the future. The market also enters bear and bull status over time, including some major crashes, such as the ones in 2009 and 2020.

^SPX Chart
^SPX data by YCharts.

If investors can handle the volatility, they're likely to come out on top. Investing in the stock market is about staying in for the long haul and reaping the benefits.

If this pattern continues, the S&P 500 should reach 10,000 even before 2030. But can it?

The economy drives the markets

Patterns and track records aren't everything. If there are major headwinds in the economy, like there are now, they could interfere with the S&P 500's gains. Annualized, the S&P 500 has gained 10.5% over the past 10 years. But that includes wild divergences over that time.

Metric 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023

S&P 500 return

13.7% 1.4% 12.0% 21.8% (4.4)% 31.5% 18.4% 28.7% (18.1)% 26.3%

Data source: Berkshire Hathaway shareholder letters. Includes dividends. Brackets indicate negative returns.  

It's easy to see how macroeconomic factors impact the markets each year. This is a small, recent snapshot, but you can clearly see how global and macroeconomic events dictated market reactions. A pandemic crash led to a 10-year high and several bountiful years, and that led to high inflation, followed by the market's worst loss in 10 years in 2022. Finally, there was a rebound and a bull market in 2023. 2024 is more tepid so far, and inflation's trajectory, as well as how interest rates move, will influence how the rest of the year plays out.

What will happen between now and 2030 is anyone's guess, although the years are sure to include better and worse results, likely culminating in a steady but not linear overall gain.

Only as big as the stocks it comprises

The S&P 500 is a market cap-weighted index of around 500 of the top U.S. companies. Large companies like Apple and Alphabet make up a disproportionate amount of the total value of the index. So if the larger companies see slower growth, it could affect the index's run adversely, and vice versa. In fact, some of these companies with trillion-dollar market caps have witnessed slowing growth in recent years.

All in all, it won't be surprising to see the S&P 500 growing at a slower pace in the future. For example, while it gained only 174% over the past 10 years, the index returned a massive 315% in the 10 years between 1990 and 2000. It's easier to double 500 to 1000 than 5,000 to 10,000.

It's conceptually hard to imagine the S&P 500 smashing through 10,000, but it could still happen within the next five years or not too long after. While inflation is proving to be sticky with the Federal Reserve keeping interest rates high to counter it and quell recession fears, all that the economy needs is further innovation, as well as businesses to take advantage of those innovations, in order to continue propelling the index higher.

And a more optimistic and steadier economy should lead to better performance for more companies, translating into higher confidence in the stock market.

To see it more clearly, turning the current market of 5,300 into 10,000 requires a compound annual growth rate (CAGR) of 13.5% over the next five or so years. While I wouldn't expect linear growth, that's a reasonable expectation under optimistic conditions.

On a more practical note, using historic annual return average rates of 10% for the S&P 500, that target should still be achievable by 2032.