The S&P 500 (SNPINDEX: ^GSPC) suffered its sharpest decline in five decades during the first half of 2022, tumbling 20.6% as recession fears rippled through Wall Street. But cooling inflation and better-than-expected economic growth have buoyed investor sentiment this year.

The S&P 500 skyrocketed 15.9% in the first half of 2023, notching its third-best performance in the last quarter century. And one stock market indicator says the index is headed even higher in the second half.

Here's what investors should know.

Abstract stock market chart shown in colors of blue, orange, and red.

Image source: Getty Images.

History says the S&P 500 could rise 9% by the end of 2023

Since 1945, the S&P 500 returned an average of 4.2% in the second half of each year, and the index produced a positive return 69% of the time, according to the Center for Financial Research and Analysis (CFRA). But the stock market tends to run on momentum, at least over short periods of time, so a strong first half often leads to an above-average second half.

According to the CFRA, during years when the S&P 500 returned more than 10% in the first half, the index returned an average of 8% in the second half, and it produced a positive return 82% of the time. In other words, history says the S&P 500 could add another 8% in the last six months of the year. It's worth mentioning that the index is currently down 1% in the second half, so the implied upside is 9% from its current level.

Consider buying an S&P 500 index fund

Investors should avoid short-term strategies. Stock market momentum can shift in the blink of an eye, and past results never guarantee future returns. But patient investors hoping to benefit from the stock market's current momentum can confidently buy an S&P 500 index fund like the Vanguard S&P 500 ETF (VOO 1.00%), provided they are willing to hold the index fund for a long period of time.

Why? The S&P 500 may or may not be a profitable investment during the second half of 2023, but history says the odds of a positive return increase as the holding period lengthens. In fact, the S&P 500 has produced a positive return over every rolling 20-year period since its inception in 1957, and its precursor (the Composite Stock Index) produced a positive return over every rolling 20-year period since its inception in 1926.

But reliable returns are not the only reason to buy shares of the Vanguard S&P 500 ETF. Investors also get exposure to hundreds of blue-chip businesses. The index fund spreads capital across value stocks and growth stocks from all 11 market sectors, and that diversity limits downside risk compared to a portfolio of individual stocks. That makes the Vanguard S&P 500 ETF a great option for risk-averse investors that want exposure to the stock market, or risk-tolerant investors that want to diversify a portfolio of individual stocks.

Consider buying shares of Amazon and PayPal

Many excellent growth stocks are currently trading at discounts to their historical valuations. For instance, Amazon (AMZN 3.43%) enjoys a strong presence in e-commerce, cloud computing, and digital advertising -- three markets expected to grow quickly in the coming years -- yet shares currently trade at 2.5 times sales, a discount to the five-year average of 3.5 times sales. That compelling buying opportunity has two billionaires piling into the stock.

Similarly, PayPal Holdings (PYPL 2.90%) is the market leader in online payment processing software. In fact, the fintech company holds twice as much market share as its closest competitor Stripe, meaning it is well positioned to benefit as e-commerce sales climb in the coming years. Yet shares currently trade at 2.7 times sales, a bargain compared to the five-year average of 8 times sales. Not surprisingly, the stock currently carries a buy rating among Wall Street analysts, and the median price target implies 29% upside over the next year.

Here's the bottom line: The S&P 500 delivered an impressive performance in the first half of 2023, and history says that momentum could drive the index higher by the end of the year. But even if that momentum fizzles and gains fail to materialize, patient investors who buy an S&P 500 index fund today will likely be better off in a decade. The same applies to investors who buy shares of Amazon and PayPal today.