The S&P 500 started 2023 with a bang, rising nearly 2% during the first four trading days of the year. The rally was attributed mostly to Friday's jobs report, which showed wages grew at a slower pace in December compared with one year earlier. Investors cheered the news as a sign that inflation in general could be slowing down, fueling optimism that the Federal Reserve could ease up on interest rate increases anticipated for 2023.

Still, a 2% increase is barely a blip following a rotten year for stocks. The S&P 500 index, which represents about 80% of the value of the U.S. stock market, dropped by more than 19% in 2022. That's the worst year on record since 2008, at the height of the financial crisis. So despite last week's rally, you may be wondering: Is it safe to invest in the S&P 500 index right now?

An investor checks her portfolio performance on a smartphone.

Image source: Getty Images.

Why last week's rally doesn't matter

When stock prices rise or fall, it doesn't tell you anything about the health of the economy. Stock price movements tell us about investors' confidence, or lack thereof, on any given day. But investor perceptions aren't always accurate. Stocks rallied on Friday simply because investors were speculating about how the Fed will respond to signs of slower inflation.

But attempting to time the market is a losing game. Investing consistently and keeping put your money for the long term is what yields results -- and the S&P 500 index has an incredible history of producing positive returns for patient investors, with annual returns averaging about 10%.

Consider this research from Capital Group, which compared the returns of two hypothetical investors, each of whom invested $10,000 in the S&P 500 index every year between 1999 and 2018. Investor A had the incredible luck to pick the best day to invest -- meaning the S&P 500 index was at its lowest point in the year -- for each of the 20 years. Investor B, however, had terrible luck and invested money at the market's peak for each of the 20 consecutive years.

Obviously, Investor A came out ahead, but the returns of the two portfolios didn't vary as dramatically as you'd expect. Investor A's average annual returns worked out to 9.16%. But Investor B's average annual returns were a respectable 6.91%. 

Is it safe to invest in the S&P 500 right now?

If you won't need your money for decades, pretty much any time is a good time to invest in the S&P 500. However, the question you should be asking isn't whether it's safe to invest based on current market conditions. A better question is: Can I afford to invest money in stocks based on my personal goals and circumstances?

Historically, over a 10-year period, the S&P 500 has delivered positive returns more than 90% of the time. And over a 20-year stretch, the index has never produced negative returns. But the odds of positive returns are a lot slimmer over shorter stretches. In a one-year period, you have about a 1-in-4 chance of negative returns.

If you have money that you expect to need in the next year or two to buy a home or pay your child's college tuition next year, that money doesn't belong in the stock market. Likewise, if you don't have a six-month emergency fund, focus on building that up first so that you don't have to sell investments when they're down to cover an unexpected expense. But if you can afford to invest based on your time horizon, now is a perfectly safe time to invest in the S&P 500.