Millions of Americans have seen their incomes take a hit during the COVID-19 outbreak. But not everyone is struggling right now. Some people are actually saving money -- because they aren't commuting to work or spending on leisure and entertainment outside the home.

If you have money to spare right now, you may be thinking of investing -- even if you've never done so before. And while you might think that diving in during a pandemic is a bad idea, it's actually a great one.

Prior to the COVID-19 crisis, stocks were largely overvalued. Now that stocks are more affordable, you have a solid opportunity to build an investment portfolio that will serve you well for the long haul.

Silver dice reading buy and sell on top sitting on a graph

Image source: Getty Images.

Still, you may need some guidance if you're gearing up to invest for the first time, and during a period that might be more volatile than usual. Here are a few tips that will help you get started.

1. Plan to hold your investments for many years

Buying quality stocks and holding them for a long time is the recommended strategy in general, but it's especially important during a pandemic. Back in March we saw bad news on the COVID-19 front drive stocks into bear market territory, and if there's a second wave of outbreaks later on in the year, the same thing may happen. That's why, if you're going to buy stocks, you shouldn't plan to get in and get out quickly. Rather, expect that you'll hold those stocks for a long time so that their value can grow for you through the years. At the same time, don't invest money you expect to need within the next decade. That way you'll be less likely to cash out investments out of desperation when they're down.

2. Don't panic when the market tumbles

In mid-February of 2020, Costco (COST -0.24%) was consistently trading at around $320 per share. In mid-March its share price fell to about $280 when the stock market bottomed out, and as of June 2, it's sitting much prettier at $305. Meanwhile Costco is a stock that should not have been affected too drastically by COVID-19, at least not in theory, as the demand for food and household supplies never waned.

Costco's stock price dropped in March because the market on a whole got battered, and that's apt to happen not just during a pandemic, but anytime there's news that shakes thing up (like election results, for example). If you're going to invest, you'll need to prepare mentally for the fact that the market will crash from time to time, but you should also pledge not to let that serve as a source of panic. If you give in to that fear, it could drive you to sell off investments when they're down, thereby locking in losses rather than riding out those storms and letting the market recover.

3. Aim to diversify

Diversification is one of the best risk-mitigation strategies you can employ when building an investment portfolio. If you buy up stocks across a range of industries, you'll be better protected in the event that a single sector takes a hit.

Think about the travel industry, and the impact COVID-19 has had on it. If your portfolio was 60% travel stocks prior to the pandemic, you'd be looking at a pretty sorry account balance right about now. But a portfolio that's 10% travel stocks may not be looking as dire.

That's why it pays to build a diverse portfolio, and you can do so by buying up an array of individual stocks, or by investing in index funds. Index funds follow existing market indexes so that if, for example, you buy an S&P 500 index fund, you'll effectively be putting your money into the 500 largest U.S. stocks based on market capitalization.

Investing can be a daunting prospect when you're first getting started. Throw a pandemic into the mix, and it can be even more stressful. But if you go in with a plan and the right frame of mind, you're more likely to be successful at it.