Investing in exchange-traded funds (ETFs) is a smart decision for a variety of reasons. They create instant diversification, limiting your risk. They're also passively managed, making them less expensive than their actively managed counterparts.

Choosing the right ETF, however, can sometimes be a challenge. With seemingly limitless funds to choose from, it can be difficult to determine which one is the best fit for your situation.

Two of the most popular ETFs are the Invesco QQQ ETF (QQQ -0.78%) and the Vanguard S&P 500 ETF (VOO -0.56%). There are advantages and disadvantages to both of these funds, so here's how to decide which one is the better buy.

Gold figurines of a bear and a bull

Image source: Getty Images.

QQQ

The Invesco QQQ ETF tracks the Nasdaq-100 Index. This includes 100 of the largest domestic and international non-financial stocks listed on the Nasdaq. Close to half (47%) of the fund is comprised of stocks in the information technology sector, but it also includes stocks from the consumer, communication services, healthcare, industrial, and utilities industries.

This fund was established in 1999, making it one of the older ETFs in existence. It also has a strong history, earning an average 9.38% annual rate of return since its inception. This makes it an excellent choice for long-term investors. While nobody can predict future returns, QQQ's decades-long track record is a good indication that it will perform well over time.

The biggest disadvantage of this fund is that it doesn't provide as much diversification as some other ETFs. It currently includes 102 stocks, half of which are from the tech industry. This increases your risk slightly compared to other funds that contain several hundred stocks from a wide variety of industries.

In addition, because this fund is heavily weighted toward tech stocks, it could pose more risk. Tech stocks are known for their volatility, which makes them riskier than stocks from more established industries. That said, tech stocks are also known for explosive growth. While you're taking on more risk, this fund also has the potential for higher-than-average returns.

VOO

The Vanguard S&P 500 ETF tracks the S&P 500, which is a stock market index that includes 500 large U.S.-based corporations. It's a good representation of the market as a whole, which means that an S&P 500 ETF will essentially follow the market.

A significant advantage of this ETF is that it provides more diversification. It includes just over 500 stocks, which makes this fund lower risk than QQQ. In addition, although this ETF also is heavy on tech stocks, the information-technology sector only makes up 27% of the fund, rather than 47% with QQQ. In other words, your money is spread more evenly across a wider variety of industries with VOO.

One downside to VOO is that it doesn't have a long track record, as it was established in 2010. It has earned an average return of around 15% per year since its inception, but that's largely due to the tremendous bull market we've experienced since 2010.

This ETF tracks the S&P 500 -- which was established in 1957. So while this particular fund is relatively young, the index it's based on does have a long history of positive returns.

In fact, since the S&P 500 was created, it has experienced an average rate of return of around 10% per year. Again, while no one can predict future returns, there's a good chance VOO will experience average returns of around 10% per year over the long run.

Which ETF is right for you?

Both QQQ and VOO are fantastic investments, and investing in either one would be a good choice. QQQ may be a better bet for those willing to take on slightly more risk for the chance at earning higher-than-average returns, while VOO might be a good option for more risk-averse investors looking for slow-but-steady growth over time.

Either way, both ETFs are long-term investments that perform best when left alone for as long as possible. Whether you decide to invest in QQQ or VOO (or both!), investing for the long term is the best way to see substantial returns.