Don't let the fact that the market is starting to look overheated fool you. Stocks are still the way to go if you want to build wealth over the long run.

Cash

Source: Flickr.

According to recent data released by the Federal Reserve, the last time fewer Americans owned stocks than they do now was 1995. And many more rich Americans own stocks than does the rest of the country. While the wealth gap in America has been widening because of a bunch of factors, one of them is definitely investment choices.

The data is even more alarming than it sounds
The Federal Reserve Survey of Consumer Finances shows that only 48.8% of Americans own stock as of the latest data. However, even though this number sounds low, it includes people who own stocks indirectly, such as through a 401(k) or mutual fund.

Only 14% of Americans own stocks directly, which is down by a third since 2001. So very few Americans actually deposit money into a brokerage account and purchase shares for their own portfolios.

Percentage of Americans Who Own Stocks (Direct or Indirect) | Create Infographics

However, there is a big difference between the investment habits of the wealthy and the rest of the country. The vast majority (93%) of the wealthiest 10% of Americans own stocks, more than three times the 26% ownership rate of the bottom 40%.

Furthermore, the mean value of the average American investor's stock holdings has risen by more than 18% since the last survey in 2010 and is higher than it was in 2007, before the recession. In short, people who own stock have gotten richer from the U.S. economic recovery.

Why people who buy stocks get rich
Stocks make people money by using the simple principal of compounding returns combined with a healthy level of risk.

Before we go any further, don't confuse investing in stocks with speculating. Buying shares of Microsoft or Procter & Gamble is investing. Buying the "next big thing" like Tesla Motors is speculative, even though I think it is an excellent, well-run company. For the purposes of this article, we're talking about solid, established companies to hold for the long haul.

The market can move up and down, but stocks have an upward bias over the long term. This has to do with factors such as inflation, share repurchase plans, and the reinvestment of profits into businesses. But over time, stocks have always risen, and will always rise, over the long term.

In fact, over the past 20 years, the S&P 500, which is arguably the best indicator of how the overall market is performing, has averaged total returns (which includes dividends) of 9.3% per year. More impressively, this time period saw two of the biggest market crashes in recent history.

Now, if those gains are allowed to compound year after year, your money can really build up. Let's say that you put $10,000 in an S&P 500 index fund and that you average that same annual return. Well, after one year, your portfolio could grow by $930 (9.3%). The next year, you're earning that return on a portfolio of $10,930, or about $1,016. And each year, there is more money in your account to earn returns.

Of course, this is a simplified example, and some years will be better or worse, but over time the concept works. In fact, averaging a 9.3% return, a $10,000 portfolio would grow to more than $144,000 over 30 years. That's how the rich keep getting richer.

But isn't the market too high right now?
Although there may be a better entry point coming up in the future, such as the market correction everyone has been calling for, it's a fool's errand to try to time the market. But even those who buy at the peak do very well over the long run.

Let's consider the case of a hypothetical investor who bought into the stock market at the worst time in the past 30 years: Friday, Oct. 16, 1987, the day before Black Monday hit and triggered a one-day drop of nearly 23% in the Dow Jones.

^SPXTR Chart

If our investor had simply bought an S&P index fund on that date and suffered through the ensuing market panic, that person would be sitting on a total return of about 1,240% in his or her portfolio, or an average return of just over 10% per year including the 1987 collapse.

The best course of action
Simply put, the best thing you can do for your future is to buy stocks (or stock funds, if you're uncomfortable picking your own stocks). Buy when the market is down, buy when the market is up, and buy when the market isn't doing much of anything.

Over time, the power of compounded gains and the upward bias of stock prices will overcome the effects of any volatility along the way and will create real wealth in your portfolio.

Matthew Frankel has no position in any stocks mentioned. The Motley Fool recommends Procter & Gamble and Tesla Motors and owns shares of Microsoft and Tesla Motors. Try any of our Foolish newsletter services free for 30 days. We Fools don't all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.