The last 16 months have been rough for investors. Recession fears sent the S&P 500 tumbling into a bear market in early 2022, and the broad-based index is still down 14% from its high. This means that $6 trillion has been wiped out by economic headwinds. But the S&P 500 is within striking distance of bull market territory.

By definition, a bull market begins when the index rebounds 20% from its low, and the S&P 500 is currently up 16% from the low point it hit last October. Investors should be thrilled by that development. Since 1957, the average S&P 500 bull market has run for 1,960 days, producing an average return of 184%, according to data from Yardeni.

One way investors can capitalize on that information is by purchasing an S&P 500 index fund.

A geometric bull ready to charge.

Image source: Getty Images.

Warren Buffett has often recommended an S&P 500 index fund

Warren Buffett is one of the most successful investors in history, and that success has made him a North Star in the financial world. Investors analyze his every word and pour over Berkshire Hathaway's Form 13F filings with the U.S. Securities and Exchange Commission in search of stock tips.

Buffett has often said that an S&P 500 index fund is the best way for most investors to gain exposure to the stock market. Buffett himself owns two S&P 500 index funds through Berkshire Hathaway: the Vanguard S&P 500 ETF (VOO -0.72%) and SPDR S&P 500 ETF Trust.

They are essentially identical, though I prefer the Vanguard ETF simply because it's the least expensive option. It bears an expense ratio of 0.03%, so investors would pay just $30 in annual fees on a $100,000 portfolio. The SPDR S&P 500 ETF Trust bears a slightly higher expense ratio of 0.0945%.

Regardless, the investment thesis is straightforward: The S&P 500 measures the performance of 500 large U.S. companies. Its constituents span all 11 market sectors and represent a blend of value stocks and growth stocks.

That makes the index a benchmark for the broader U.S. economy, which happens to be the largest economy in the world. To quote Buffett: "For 240 years it's been a terrible mistake to bet against America, and now is no time to start. America's golden goose of commerce and innovation will continue to lay more and larger eggs."

The S&P 500 has been a sure-fire investment throughout history

The S&P 500 has produced a positive return over every rolling 20-year period since its inception in 1957, and there's no reason to expect a different outcome in the future. That means any investor who buys an S&P 500 index fund today is all but guaranteed to make money, provided they stay invested for at least 20 years.

To quote Buffett once again: "I have yet to see a time when it made sense to make a long-term bet against America. And I doubt very much that any reader of this letter will have a different experience in the future."

Index funds can turn patient investors into stock market millionaires

The U.S. has suffered several bear markets and recessions during the last two decades, but the S&P 500 still produced a total return of 556% (or 9.9% annually) during that time period. Investors who regularly contribute to an S&P 500 index fund can expect similar returns going forward. That may not sound like much, but through the power of compounding, annualized returns of 9.9% can still turn relatively small sums of money into million-dollar portfolios, given a long-enough holding period.

At 9.9% annually, $125 invested weekly in an S&P 500 index fund would be worth $103,000 in a decade, $368,000 in two decades, and $1 million in three decades. Alternatively, as my colleague Courtney Carlsen discusses in this article, $500 invested monthly in the SPDR S&P 500 ETF over the last 20 years would be worth $375,000 today.

Here's the bottom line: Investors who regularly contribute to an S&P 500 index fund, buying through thick and thin, will almost certainly be much better off a decade (or three) down the road. Moreover, with the S&P 500 index near bull market territory, now is a particularly good time to start buying (or keep buying) an S&P 500 index fund.