The technology hardware business has a reputation for being very cyclical and economically sensitive. However, the following three stocks -- Taiwan Semiconductor Manufacturing (TSM -3.45%), ASML Holdings (ASML -3.32%), and NVIDIA (NVDA -10.01%) -- have all absolutely trounced the market this year, despite their hardware-focused businesses and a pandemic-fueled recession.

TSM Year to Date Total Returns (Daily) Chart

TSM Year to Date Total Returns (Daily) data by YCharts

What's their secret? Each of these companies plays in some of the best long-term growth markets of 5G and artificial intelligence (AI) computing. While the COVID-19 pandemic is clearly weighing on demand for certain tech products, the 5G and AI races are proving to be sectors in which everyone is still competing, and demand for these leading-edge products isn't slowing down.

But merely playing in growth industries alone isn't enough. On top of that, these three companies also have deep competitive advantages over rivals that have made them truly unstoppable stocks. Here's how these three companies have built and maintained these killer advantages, and why they should continue winning in 2020 and beyond. 

small stick figures race on large balls made of clocks with one with many clocks within it blazing ahead of the others.

Three tech stocks with formidable moats. Image source: Getty Images.

Taiwan Semiconductor Manufacturing: the world's best manufacturer

Taiwan Semiconductor Manufacturing just had its earnings report last week, and the results were something to behold. Consider this: Taiwan Semi's largest segment is in producing chips for smartphones, making up 47% of its sales. Amid the coronavirus recession, smartphone units are expected to decline by the mid-teens for 2020. Even worse for Taiwan Semi, it was just prevented from shipping chips to its second largest customer in China's Huawei as of May 15, because of new U.S. trade rules.

Yet in spite of all this, TSM delivered blockbuster results for the second quarter, while also raising guidance for the remainder of the year. TSM now anticipates growing its revenue by over 20% this year, above last quarter's full-year guidance of mid- to high teens.

What's TSM's killer advantage that has allowed it to not just survive but thrive amid the smartphone lull and Huawei ban?

As chips have become smaller and smaller, and packed with more and more transistors, they run up against the limits of Moore's Law, which states that chips can become twice as powerful every 18 months to two years. Recently, chips have gotten so small and densely packed that it has made their manufacturing increasingly difficult.

As the world's leading foundry that makes different chips for a diverse array of customers, Taiwan Semi was able to pool its collective knowledge and leap ahead of Intel (INTC -2.40%) in the race to a leading-edge 7nm chip in 2018. As companies and entire countries are clamoring for leading chips to cement their own advantages, Taiwan Semi's capabilities are now in extremely high demand.

So even as Huawei fell by the wayside, demand from other chip companies has easily filled in the gap, leaving TSM's outlook unchanged. And Taiwan Semi isn't slowing down either; it expects to move on to 5nm chips and sell them before the year is out.

While other semiconductor manufacturers are still struggling to bring 7nm chips to market, it appears as if the manufacturing gap between TSM and rivals is widening, not narrowing.

ASML: Taiwan Semiconductor's most important vendor

What enables TSM's efficient scaling of smaller and smaller chips? Much of the credit goes to another company with its own killer advantage: ASML Holdings.

ASML is the sole provider of extreme ultraviolet lithography (EUV), a technology that was 20 years in the making with no certainty any company would ever get it right. Fortunately, ASML managed to crack the code just in time for the 7nm node, when EUV would become a differentiator over multi-patterning. Since the technology was so hard to achieve, ASML basically has a monopoly on EUV technology today.

EUV is so important because it dramatically cuts down the number of manufacturing steps -- which can number in the hundreds -- that are needed to produce tiny chips with billions of transistors. As such, ASML has seen demand for EUV greatly increase over the past two years, and keep in mind these machines go for $100 million to $150 million a pop.

Like TSM, ASML also recently had its second-quarter earnings release, and the results were impressive. Despite some delays in the first quarter due to logistics constraints, ASML management has left its initial positive 2020 growth projections unchanged. Due to the opening back up of the supply chain, ASML saw a 35% growth over the first quarter, and had every shipment been recognized within the quarter, quarter-over-quarter revenue growth would have been an even greater 50%. CEO Peter Winnick said:

With significant work-from-home and remote learning activities continuing, segments such as data center and communication infrastructure continue to be strong. Demand for consumer-related electronics, for example, smartphones may be under some near term stress due to the economic impact from COVID and our customers indicate they see continued strength in end markets requiring advanced nodes. And this is reflected in our stable demand.

While overall electronics sales may be muted, companies are still aggressively rolling out 5G, and data center customers are investing to keep up with the work-from-home economy. That means leading-edge nodes enabled by ASML's EUV technology should see consistent demand, pulling ASML's stock along with it.

NVIDIA: CUDA keeps competitors away

Another stock that has skyrocketed in spite of the pandemic is NVIDIA. Once again, NVIDIA is defying the COVID-19 recession because of its competitive advantages within key segments that are doing well in the pandemic:  video games and AI computing.

NVIDIA emerged as a leader in graphics chips (GPUs) in the early 2000s, and 20 years and $20 billion in research and development investment later, it's a lead that the company still maintains to this day. In a video gaming world that is far larger now and still growing quite fast, NVIDIA's gaming chip growth rate should accelerate amid the COVID-19 pandemic into next year.

However, in 2006, NVIDIA developed its CUDA platform -- a single architecture that combines hardware, software, and algorithms, which opens up GPUs to the capabilities of parallel processing other forms of data besides visual graphics. As it turns out, GPUs are ideally suited to the accelerated computing capabilities for AI that can't be achieved with typical CPU processors alone.

The CUDA platform incorporates not only NVIDIA's advanced chips but also system software, programmable algorithms, libraries, systems, and services. This first-mover, interconnected walled garden platform provides a strong "moat" for NVIDIA compared with other competitive chips that may be more easily interchangeable. And NVIDIA continues to widen its moat under founder and CEO Jensen Huang, who continually reinvests in better and better GPUs, such as the company's brand-new AI A100 chip unveiled in May.

While the graphics segment is gearing up for the next wave of gaming consoles hitting the market later this year, NVIDIA's data center AI chips are already taking off, with the company's data center segment up 80% year-over-year in Q1, despite the COVID-19 outbreak. Clearly, NVIDIA's formidable position in these in-demand segments gives it a killer advantage to survive the COVID-19 pandemic and thrive on the other side.