Machine vision company Cognex (CGNX 0.66%) rounded off its fiscal 2020 with a year-over-year revenue increase of 32% in the fourth quarter, and managed to report a record full-year sales number. Moreover, the company demonstrated its earnings resiliency by offsetting a 20% decline in its automotive-related sales with strong growth elsewhere.

Record sales, earnings resiliency, strong momentum -- does that all add up to make the stock a buy? Let's take a closer look.

Cognex key end markets

To understand what happened last year, it's a good idea to think about Cognex in four different buckets. The first three are the company's core end markets of automotive, consumer electronics, and the fast-growing logistics business. The fourth is basically everything else, including consumer products, food and beverage, medical, and semiconductors, which together made up 30% of revenue in 2020.

Smartphone layers.

Cognex's machine vision helps smartphone companies layer screens. Image source: Getty Images.

Each one of the core businesses has experienced unusual dynamics over the last couple of years. The automotive and consumer electronics industries have always been the earliest adopters of automation technology, so it's no surprise that they traditionally contribute the bulk of revenue.

Automotive end market

It's been a difficult couple of years for Cognex's automotive-related sales, highlighted by the 20% decline in revenue in 2020. The segment was already dealing with a decline in automotive production going into 2020, and that was before it had to factor in COVID-19-related plant shutdowns, car plant shutdowns caused by chip shortages, and car companies holding back investment in traditional internal combustion engines (ICE).

On a brighter note, Cognex should see some improvement from its exposure to electric vehicle (EV) spending, but it could take a while before EV-related tailwinds overcome headwinds from spending on ICE. As such, automotive-related revenue fell to around 20% of full-year sales.

Consumer electronics

Apple has previously been named as Cognex's largest customer, so it's most probably the company referred to in the 10-K SEC filing as a large consumer electronics company responsible for more than 10% of Cognex's revenue in 2020. To quote CEO Rob Willett on the earnings call, "Much of our revenue in consumer electronics relates to the assembly of smartphones and the production of related components."

Cognex's consumer electronics-related revenue rose 30% in 2020, and now represents around 30% of its sales. However, investors shouldn't assume that will be the rate of growth in the future. In fact, spending from Cognex's consumer electronics customers actually fell in 2019. It's a testimony to the cycles of smart phone development spending.

Logistics

The standout performer over the last few years, Cognex's logistics-related revenue growth was already strong going into 2020. An explosion of interest in e-commerce following the lockdown measures added even more fuel to the fire. In fact, Cognex's logistics-based sales increased 40% in 2020, and at 20% of sales now represents the company's second-largest market.

Cognex also now has another customer responsible for more than 10% of sales in 2020. Based on management's commentary on the customer -- describing it as "a major investor in automation and one, I think that still has a very small share of the overall market that it can address" -- it's likely that Cognex will see more orders from it in the future.

Bad year, good year

Given the pandemic's impact on the year, Cognex's 12% revenue growth was a very impressive performance. However, it still needs to be put into a longer-term context. Cognex's $811 million in full-year 2020 sales may well be a record, but it's not that more than the $806 million reported in 2018.

In a nutshell, Cognex had a couple of disappointing years in 2018 and 2019 -- consumer electronics spending weakened in the former, while automotive and consumer electronics revenue fell at the same time in 2019.

Turning to 2020, it's clear that the company benefits from a bounce back in spending from smartphone customers and ongoing strength in logistics.

Is Cognex a buy?

Putting all of these points together, just as investors may have been too pessimistic on Cognex's long-term future through 2018 and 2019, it looks like they might be too optimistic after a very good 2020.

CGNX Chart

Data by YCharts

Cognex is still a great growth company but the near-term automotive outlook isn't great, and consumer electronics has proved to be unpredictable. Logistics is great, but at 20% of revenue is it enough to justify buying a stock trading at 76 times estimated 2021 earnings? All told, Cognex is going to need some pretty large deals in 2021 in order to justify such a valuation.