Investing needn't be a daunting task, but building a robust portfolio does require patience and discipline. Buying great companies is the first step toward creating a resilient, all-weather portfolio that can help compound your wealth over the years. Such companies can enjoy many years of steady growth, and their share prices will rise in tandem. They are also more likely to be resilient in the face of adversity and can weather crises such as the COVID-19 pandemic.

The key to enjoying a secure retirement lies in buying stocks that have a recognizable brand name, sturdy financials and a large addressable market. It also helps if these companies are part of a megatrend that can last for years or even decades. Megatrends are trends that play out over years and set the tone for a revolution in the way we live, work, or interact.

Here are three quality stocks you can consider buying and holding over decades.

Tying laces on running shoes

Image source: Getty Images.

Nike

Nike (NKE -1.26%) is recognized as one of the most iconic brand names in the athletic footwear and apparel industry. The company has more than 1,000 Nike-branded stores in both the U.S. and international markets and chalked up revenue of $37.4 billion for the fiscal year ended May 31.

Although Nike incurred a $790 million net loss for its fourth quarter, investors should note that this was chiefly due to numerous store closures in North America, Asia, Europe, and the Middle East. The COVID-19 pandemic necessitated lockdowns and movement restriction orders in multiple countries, resulting in widespread temporary closures. As of late June, almost 90% of Nike-owned stores around the world are open, while 100% of its China stores are now operational.

The company has navigated the pandemic well, though. Digital sales soared 75% year over year in the fourth quarter and were broad-based across all geographies. Nike has also committed to expanding its digital program with an initiative called "Consumer Direct Acceleration," or CDA. CDA is meant to simplify the company's operations, categories, and leadership to drive deeper consumer connections, boosting profitability over the long term.

Visa

Visa (V -0.59%) is a financial services company that has a long track record, global reach, and recognizable brand name. For years, the company has been latching on to the digital payments megatrend that has seen many countries shift from cash to digital transactions.

COVID-19 has introduced tailwinds to Visa's business by accelerating digital adoption, especially for businesses and individuals that had been bogged down by inertia. Visa has not only strengthened relationships with its key clients recently, but has also built up a strong foundation for growth by acquiring financial technology (fintech) companies such as Plaid. Plaid's platform helps consumers securely connect their financial accounts to the apps they use, thus assisting them to better manage their finances. In the same month, Visa also made a strategic investment in another fintech company, Very Good Security, of an undisclosed sum. This company acts as a liability buffer for fintech start-ups by storing sensitive data such as account numbers and personal information. Last year, Visa also acquired Earthport, a company that provides cross-border payment services to banks, money transfer service providers and businesses. These acquisitions show Visa's commitment to boosting its fintech capabilities.

Although the coronavirus severely impacted spending in April, May witnessed a rebound as lockdowns eased in many countries. Improvements in spending continued on through June and July, with U.S. payments volume turning positive in June and showing an almost 10% year over year increase in July. The company is poised to ride the recovery in spending once economies return to normalcy, and stands to benefit from the long-term shift to digital payments.

Apple

Apple (AAPL -1.22%) is a smartphone leader that continues to churn out innovative products. The creator of the iconic iPhone has also developed a strong network effect with its ecosystem of apps and developers with its App Store, and the company has, in recent years, pivoted more toward services as it seeks to wean itself off its reliance on product sales.

The company's wearables division still has significant potential for growth as it prepares to release a new iteration of its Apple Watch that is rumored to feature water resistance, a micro-LED display, and a sleep tracker. The division made up 10.8% of total revenue in Apple's latest quarter, up from 10.3% a year ago. 

Services have also been gaining ground, with a 14.8% year-over-year jump in revenue to make up 22% of total revenue. The strength of this division lies in its subscription model, and this will drive higher levels of recurring income for the technology company over time. The services segment also commands more than twice the gross profit margin of the overall products division, at 67.2% versus 29.7% for the third quarter of fiscal year 2020. Investors can expect long-term margins to rise as this segment gains prominence over time, while Apple's multiple service offerings offer a myriad of options for consumers.

Editors' Note: An earlier version of this article incorrectly stated that Visa had acquired Very Good Security.