Investing in the stock market can help you generate life-changing wealth, and you don't have to have a lot of money to get started. Small investments can go a long way, especially if you get started sooner rather than later.

It's critical, though, to invest in the right places. The stock market can be daunting if you're a beginner investor, and if you unknowingly choose the wrong stocks or funds, you could lose more than you gain.

Fortunately, there's one surefire investment that's almost guaranteed to help you build long-term wealth -- and it requires very little effort on your part. Here's everything you need to know to get started.

A safer way to generate wealth

Whether you're new to the stock market or simply want a safer and more reliable investment, an S&P 500 index fund can be the perfect starting point.

Person sitting at a desk using a laptop.

Image source: Getty Images.

An index fund is a basket of securities bundled into a single investment, and each fund tracks a particular stock market index. Some index funds cover the broader market, while others track specific industries or categories of companies -- such as the tech sector or international stocks.

An S&P 500 index fund, then, tracks the S&P 500 index. By investing in just one index fund, you'll instantly own a stake in all 500 companies listed in the S&P 500. These stocks range from tech giants like Apple and Amazon to well-established brands like Procter & Gamble and 3M.

Because each fund contains roughly 500 stocks from a wide range of industries, investing in just one index fund can create an instantly diversified portfolio. This can significantly lower your risk, as the more variety you have in your portfolio, the more protected your investments are against market volatility.

The S&P 500 also has a powerful track record. Analysts at Crestmont Research examined the index's long-term performance, and they found that every single 20-year period in the index's history ended in positive total returns. In other words, if you'd invested in an S&P 500 index fund at any point and held it for 20 years, you'd have made money -- even if the market was incredibly volatile in that time.

You could earn more than you might think

Despite being one of the safer investments out there, the S&P 500 index fund is also a powerhouse. It's often recommended by Warren Buffett, and he even famously bet $1 million that an S&P 500 index fund could outperform a group of actively managed hedge funds.

He easily won that bet, with his investment earning total returns of nearly 126% over 10 years, while the five hedge funds averaged returns of just 36% in that time.

While nobody can say exactly how stocks will perform over time, historically, the market itself has earned an average rate of return of around 10% per year. This means that although you likely won't earn 10% returns every single year, the annual ups and downs should average out to around 10% per year over decades.

Say you're investing in an S&P 500 index fund earning a 10% average annual rate of return. If you were to invest just $100 per month, here's approximately how that could add up over time:

Number of Years Total Portfolio Value
20 $69,000
25 $118,000
30 $197,000
35 $325,000
40 $531,000

Data source: Author's calculations via investor.gov.

Time is your most valuable asset when building wealth in the stock market. The earlier you can get started investing, the less you'll need to invest each month to accumulate a substantial amount of money over time.

One potential downside to consider with the S&P 500 index fund, however, is that it can't earn above-average returns. It's designed to follow the market, so it can't beat the market. If that's a priority for you, investing in individual stocks may be a better option. This strategy requires more time, effort, and research, but if you invest in strong stocks, you could earn far more than you might with an index fund.

There's no one-size-fits-all approach to investing, and the right option for you will depend on your goals and preferences. S&P 500 index funds may only earn average returns, but they're also safer, more reliable, and require much less effort than many other investments. If you're looking to dive into investing while barely lifting a finger, the S&P 500 index fund could be a great fit for your portfolio.