The stock market can be unnerving, especially during periods of volatility. But investing is one of the most powerful and effective ways to build wealth over time -- and you don't have to be rich to get started.

Even if you're a complete beginner or can't afford to invest much, you can still make a lot of money. Time is your most valuable resource when investing, so getting started early is often more important than investing hundreds of dollars per month.

With as little as $100 per month, it's possible to build an investment portfolio worth hundreds of thousands of dollars or more while minimizing risk. Here's how.

Why invest in the S&P 500?

There are countless investments to choose from, and there's not necessarily a right or wrong way to invest in the stock market. But if you're just getting started or want a lower-risk, lower-maintenance option, an S&P 500-tracking fund may be a good fit.

Stack of hundred dollar bills.

Image source: Getty Images.

An S&P 500 index fund or ETF will track the index itself, meaning it contains the same stocks as the S&P 500 and aims to mirror its long-term performance. The index itself includes stocks from 500 of the largest and strongest companies in the U.S., including household names ranging from Amazon to Visa to Coca-Cola and hundreds more.

By investing in an S&P 500 ETF or index fund, you'll instantly own a stake in all of the companies within the index -- and this diversification limits your risk substantially.

Also, because these stocks are from some of the healthiest companies in the world, your investment is far more likely to survive periods of market volatility. While nothing is guaranteed in the stock market, if there are any companies likely to thrive over time, it's those in the S&P 500.

How much can you earn over time?

Despite its relative safety, the S&P 500 is also a powerhouse. Even small amounts of money -- invested consistently -- can go a long way over time.

Historically, the index itself has earned an average annual return of around 10% per year. It's extremely unlikely you'll earn 10% returns every single year, but the annual highs and lows have historically averaged out to roughly 10% per year over several decades.

Assuming you're earning a 10% average annual return, here's approximately how much you could accumulate over time by investing $100 per month:

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

Data source: Author's calculations via Investor.gov

Over a lifetime, it's possible to earn over half a million dollars with just $100 per month. And if you can afford to invest even a little more, you could grow your earnings substantially.

For instance, if you were to invest $125 per month, all other factors remaining the same, you'd have roughly $664,000 after 40 years. With $150 per month, you'd reach nearly $800,000 in that timeframe.

You don't need to be rich to make a lot of money in the stock market, but getting started sooner rather than later is key. By investing whatever you can afford and keeping a long-term outlook, you'll be on your way to building a portfolio worth hundreds of thousands of dollars or more.