It has been very interesting to see the impact the novel coronavirus has had on various companies. Certain businesses have clearly suffered this year, particularly those in the travel and hospitality industries, while others have fared quite well. 

Costco (COST -0.12%) and Home Depot (HD -0.31%) fit into the latter category. Both stocks are up more than 25% this year, and I believe that either one can be a great addition to your portfolio. 

Let's find out the investment merits for both.

The case for Costco 

Thriving off of its successful membership model, Costco currently operates 800 warehouses in the U.S. and 11 other countries. Focused on keeping prices as low as possible, it has built a cult following among consumers. Total revenues (from merchandise sales and memberships fees) in fiscal 2020 are 40% higher than just four years prior, while earnings during the same stretch are up 70%. This highlights Costco's operating leverage as stores become more productive and generate more volume over time.

Shopper walking down the aisle of a retail warehouse.

Image source: Getty Images.

The onset of the coronavirus pandemic and ensuing economic turmoil have so far been extremely beneficial to Costco's business. The effects are still being felt. Sales in October were up 15.9% from the same period last year, driven by a 91.1% boost in e-commerce. 

If it wasn't already obvious before the pandemic, it should be now: Costco's value proposition only seems to be getting better. Being able to purchase many of the essentials needed during this time, at a better deal than what competitors offer, in a warehouse with ample room to socially distance, is a no-brainer for shoppers. 

Costco has been a stock market winner for a long time, and it could very well continue this trend going forward. The business is booming, and management continues opening new locations year after year. Costco opened 13 new warehouses this year, which is down from the 20it opened last fiscal year but still a promising number given the overall difficulty in the retail environment. 

It's safe to say Costco will keep this momentum going even after 2020.

The case for Home Depot 

Home Depot is benefiting from its One Home Depot strategy, which was launched in 2017 with the goal of creating a seamless, integrated, omnichannel experience for its customers. This year was a stress test to see if that investment paid off. Spoiler alert -- it did. 

Sales in the second quarter of 2020 (ended Aug. 2) rose 23.4% from last year to reach $38.1 billion. A business that was already doing well before 2020 (its stock is up 148% over the last five years) has gotten a huge lift from shelter-in-place restrictions. Consumers stuck at home with nowhere to go shifted spending from leisure, travel, and entertainment toward sprucing up their living quarters. 

On the most recent earnings call, Chairman and CEO Craig Menear addressed the shift in consumer behavior::

During the quarter we saw customers take on projects throughout their homes. From deck building, to painting projects, landscape work, and home repairs due to increased wear and tear... clearly our customer is engaged with home improvement in a meaningful way. 

It's best not to extrapolate the impressive performance this year to future periods, mainly because there is still so much uncertainty regarding the economy. Home Depot already has a large footprint with nearly 2,300 stores and has pared back its pace of openings in order to focus on driving volume at existing locations. 

Therefore, growth will continue to be bolstered by the omnichannel experience. In the most recent quarter, 60% of online orders were picked up in store. Home Depot's ability to serve its customers when and where they want is a competitive advantage. 

The final verdict 

Costco and Home Depot are both best-in-class businesses and leaders in their respective industries. In addition to having done extremely well historically, both continue to benefit from the coronavirus pandemic's effect on consumer behavior. 

Although Costco's stock trades at a considerably higher trailing price-to-earnings (P/E) ratio (41) than Home Depot's (25), I give it the nod as the better stock to own. The warehouse retailer is still expanding its store count year after year, and the nature of its business lends itself to more repeatable purchases from shoppers. 

This is in stark contrast to Home Depot where a pandemic-fueled bump in home-improvement activity could prove to be short-lived once restrictions ease, the economy starts to open back up, and spending resumes elsewhere. 

Both stocks present compelling cases, but I think Costco is the better buy.