The Federal Reserve has raised its benchmark interest rate to its highest level in more than two decades, but the U.S. economy has shown remarkable resilience in spite of tighter credit conditions. Real gross domestic product increased at an annual rate of 2.1% in the second quarter, roughly in line with the 20-year average, and Fed policymakers are forecasting similar growth for the full year.

Yet the risk of a recession remains. While business spending held up better than expected, consumer confidence is trending downward, and second-quarter consumer spending came in well below consensus estimates. Additionally, inflation has reaccelerated in recent months, so Fed policymakers plan to keep interest rates higher for longer than previously anticipated.

All of that is to say: The future is cloudy. The Fed may engineer a soft landing, or the economy could slip into a recession. The former could revitalize investor sentiment and push stocks toward a bull market; the latter would pressure corporate profits, potentially sending stocks into a nosedive. No one knows what will happen in the near term, but that is no reason to avoid the market.

Here are two index funds that have consistently made money over long periods of time.

1. The Vanguard S&P 500 ETF

The Vanguard S&P 500 ETF (VOO 1.00%) tracks 500 large-cap U.S. stocks. Its constituents span all 11 market sectors, a blend of value stocks and growth stocks, and it covers more than half of global equities by market capitalization. In other words, it is a broadly diversified index fund that spreads capital across many of the most influential businesses in the world.

The top five holdings in the Vanguard S&P 500 ETF are:

  1. Apple: 7.7%
  2. Microsoft: 6.8%
  3. Alphabet: 3.6%
  4. Amazon: 3.1%
  5. Nvidia: 2.8%

The benchmark S&P 500 index has never failed to recover its losses during any bear market or recession. The index has consistently reached new highs throughout history, and the same is true for the Vanguard S&P 500 ETF. Indeed, the index fund returned 207% over the last decade, or 11.9% annually. At that pace, $200 invested weekly would grow into $192,000 over a 10-year period.

Here's the bottom line: The Vanguard S&P 500 ETF has been a consistent moneymaker for patient investors, and there is no reason to expect a different outcome in the future. But the fund does not merely make money -- it consistently generates solid returns. In fact, less than 8% of large-cap funds outperformed the benchmark S&P 500 over the last 15 years, meaning most professional money managers would do better to simply buy an S&P 500 index fund like the Vanguard S&P 500 ETF.

Additionally, the index fund bears a below-average expense ratio of 0.03%, meaning the annual fee on a $10,000 portfolio would be just $3. That makes the Vanguard S&P 500 ETF a great option for virtually any investor, provided they plan to hold the index fund for at least five years.

2. The Vanguard Health Care ETF

The Vanguard Health Care ETF (VHT 0.03%) tracks 412 U.S. stocks in the healthcare sector that generally fall into two categories: companies that manufacture healthcare equipment or provide healthcare services, and companies involved in pharmaceutical and biotechnology research.

The top five holdings in the Vanguard Health Care ETF are:

  1. UnitedHealth Group: 8.5%
  2. Eli Lilly: 7.9%
  3. Johnson & Johnson: 6.8%
  4. AbbVie: 4.8%
  5. Merck: 4.7%

One consequential quality of the Vanguard Health Care ETF is the resilience of the underlying healthcare sector during challenging economic environments. The business cycle is generally divided into four phases: early-cycle recovery, mid-cycle expansion, late-cycle slowdown, and recession. The healthcare sector tends to outperform during the last two phases because medical products and services are usually nondiscretionary purchases.

The defensive nature of the healthcare sector has historically translated into below-average volatility in the Vanguard Health Care ETF. To quantify that statement, the index fund bears a five-year beta of 0.73, meaning it moved 73 basis points for every 100 basis-point movement in the more diversified S&P 500 over the past five years.

However, the Vanguard Health Care ETF has actually performed well through all phases of the business cycle, not just slowdowns and recessions. The index fund soared 187% over the last decade (or 11.1% annually), nearly matching the return of the S&P 500. At that pace, $200 invested weekly would grow into $184,000 over a 10-year period.

Here's the bottom line: The Vanguard Health Care ETF provides exposure to a group of stocks that should theoretically perform well in any economic environment, and it has been a consistent moneymaker over long periods of time. Additionally, with a below-average expense ratio of 0.1%, the annual fee on a $10,000 portfolio would be just $10. That makes the Vanguard Health Care ETF a great option for investors in search of a defensive index fund capable of producing strong returns.

Suzanne Frey, an executive at Alphabet, is a member of The Motley Fool's board of directors. John Mackey, former CEO of Whole Foods Market, an Amazon subsidiary, is a member of The Motley Fool's board of directors. Trevor Jennewine has positions in Amazon.com, Nvidia, and Vanguard S&P 500 ETF. The Motley Fool has positions in and recommends Alphabet, Amazon.com, Apple, Merck, Microsoft, Nvidia, and Vanguard S&P 500 ETF. The Motley Fool recommends Johnson & Johnson and UnitedHealth Group. The Motley Fool has a disclosure policy.