Becoming a stock market millionaire is a lofty goal, but it's attainable -- with the right investments.

There's not necessarily a right or wrong way to invest. If you're willing to put in the time and research involved in investing in individual stocks, you can build a personalized portfolio fit for your needs. But if you want a no-fuss investment that can make you a lot of money with next to no effort, an index fund may be a better fit.

There are plenty of index funds to choose from, but there's one that comes highly recommended by Warren Buffett and has a long track record of success. While it may not be the flashiest investment out there, it's safe, reliable, and could potentially help you reach millionaire status.

A Warren Buffett-approved investment

One of the most dependable funds out there is an S&P 500 index fund, and two come highly recommended by Buffett. Through his holding company Berkshire Hathaway, he owns two S&P 500 funds: the Vanguard S&P 500 ETF (VOO 1.00%) and the SPDR S&P 500 ETF Trust (SPY 0.95%).

Buffett also famously put his money where his mouth was by betting $1 million that an S&P 500 index fund could beat a group of actively managed hedge funds. The bet ran from 2008 to 2018, and in that time, his investment earned a total return of around 126%. Meanwhile, the five hedge funds averaged returns of just 36%.

Not only can an S&P 500 index fund potentially outperform actively managed funds, but it's also much safer than many other investments.

This type of fund tracks the S&P 500, so it includes the same stocks as the index -- or roughly 500 stocks from the largest and strongest companies in the U.S. These stocks span a wide variety of industries, which provides fantastic diversification and can limit your risk.

In addition, the S&P 500 has a long history of earning positive returns over time. Analysts at Crestmont Research studied the index's rolling 20-year total returns throughout history, and they found that every single one of those 20-year periods ended in positive total returns.

This means that no matter when you had invested in an S&P 500 index fund, you'd have made money as long as you held your investment for 20 years. If you're looking for a reliable, set-it-and-forget-it type of investment, an S&P 500 index fund can be a fantastic choice.

Building a million-dollar portfolio

With enough time and consistency, you could potentially earn $1 million or more with this type of investment. Keep in mind that there are never any guarantees when it comes to the stock market, and nobody knows how it will perform in the near term.

That said, because the S&P 500 has such a long track record of performing well over time, there's a greater chance that this investment will continue earning positive returns over the long haul.

Historically, the market itself has earned an average rate of return of around 10% per year, which means that the highs and lows of each year have averaged out to around 10% annually over several decades.

If you were to invest in an S&P 500 index fund while earning a 10% average annual return, here's approximately how much you'd need to invest each month to reach $1 million depending on how many years you have to save:

Number of Years Amount Invested per Month Total Portfolio Value
20 $1,500 $1.031 million
25 $900 $1.062 million
30 $525 $1.036 million
35 $325 $1.057 million
40 $200 $1.062 million

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

Time is your most valuable asset when building wealth in the stock market, so the sooner you can get started investing, the less you'll need to invest each month to accumulate $1 million or more.

There are no guarantees when investing, but an S&P 500 index fund is about as surefire as it gets. By investing consistently and keeping a long-term outlook, you could earn more than you might think.