Are you looking for a way to turn a little bit of money now into a lot of money later? If you're reading this, you probably are. You're also looking in the right place to make it happen. The stock market is one of the few means of building significant wealth within one lifetime, even if you're starting out with next to nothing. Indeed, a modest sum of $20,000 could become as much as $350,000 (or more) if you handle things smartly. Here's how to make it happen.

Yes, from here all the way to there

Sounds too good to be true? It isn't. A proverbial down payment of $20,000 on a comfortable future funded by a nest egg of $350,000 is not only possible but also likely. There is a catch, however.

But first things first.

Just for the sake of simplicity, let's use the S&P 500 (^GSPC 1.24%) index as our proxy for the broad stock market. It's obviously possible to own individual stocks en route to riches, but it's easier -- and often just as productive -- to simply plug into a basket of stocks like the S&P 500 itself.

Let's also assume the future will more or less look like the past. That is to say, let's assume the S&P 500 will grow by an average of 10% per year as it has for the past several decades. Some years are better than others; occasionally, the market even logs a loss for the full year. Given enough time, though, yearly 10% returns are a reasonable expectation.

Given these two assumptions, a $20,000 investment in an S&P 500 index fund today should be worth somewhere around $350,000 thirty years from now.

A $20,000 investment in an S&P 500 index fund should grow to roughly $350,000 in 30 years time.

Data source: Calculator.net. Chart by author.

However, there are two catches to achieving this sort of success with stocks.

The two big keys to success

One of these catches is how your investment is managed once it's initially been made. Once you're invested, any gains should be reinvested into the market right away. Ditto for any dividends collected.

It's called compounding. This approach ensures you've got as much money as possible working for you for as long and as often as possible, as you're earning future gains on prior gains and not just on your initial principle. Without reinvesting your gains, your average annual return on an S&P 500 index fund is cut nearly in half.

The other (related) catch is that you really need to give yourself a full 30 years to achieve this sort of long-term gain. Anything less, and you won't do nearly as well.

Take another look at the progress chart of a $20,000 investment above. Half of the $330,000 net gain was achieved only in the final seven years of the 30-year stretch. In other words, if you sat on a $20,000 investment for 23 years, you'd only end that timeframe with a little over $160,000. That's a huge difference, particularly if your nest egg will fund most of your retirement spending.

Of course, this means you'll want to put your initial money to work as early as you can in life.

Doing something small is better than nothing at all

To be clear, the example above assumes you'll make only a one-time investment of $20,000 in the stock market and never add new capital. You likely will be able to contribute fresh cash along the way, though. Even a tiny additional annual investment can make a big impact over a period of 30 years. For instance, in the example above, adding just another $2,000 to your holdings at the end of every year would ratchet your eventual nest egg up to a sum of nearly $680,000.

The underlying lesson is the same in both scenarios, though. That is, getting into the stock market as soon as possible and staying as fully invested as possible the whole time -- even when it's uncomfortable to do so -- is well worth the time and effort. A relatively small stash can become a surprisingly big one when you earn increasingly more money on your past gains and dividends.