Going into Cognex's (NASDAQ:CGNX) second quarter, expectations were muted after management pointed out that several of its large OLED display and smartphone manufacturing customers appeared to be spending less this year, after robust investment in 2017.

As the result of that trend, Cognex warned investors last quarter that its revenue growth for the coming three quarters would be flat year over year compared to 2017.

In light of that cautious outlook, investors were pleasantly surprised by the strength of the company's revenue, which was the second-highest of any quarter in the company's 37-year history, led by unexpected growth in its logistics and automotive markets. This helped Cognex beat expectations on both the top and bottom lines, as well as its own forecast.

Robotic arms assembling cars in a factory.

Image source: Getty Images.

Cognex's second quarter: The raw numbers

Metric

Q2 2018

Q2 2017

Year-Over-Year Change

Revenue

$211.26 million

$178.08 million

18.6%

Net income

$56.20 million

$56.50 million

(0.5%)

Diluted earnings per share

$0.32

$0.32

NA

Data source: Cognex's second-quarter financial report. Chart by author.

Cognex's revenue of $211.26 million exceeded analysts' consensus estimates for $204.86 million, and topped the high end of the company's forecast for $205 million at the midpoint of guidance. Profitability surprised as well, with earnings per share of $0.32 surpassing the $0.30 expected by analysts.

Gross margin of 74% was at the lower end of the mid-70% range that Cognex management expected, due to revenue mix, with a higher percentage of sales coming from lower margin application-specific customer solutions. The company helps selected companies implement its technology in "very sophisticated, high-potential major industries," where Cognex sees the opportunity for substantial growth. This can crimp margins over the shorter term, but provide compelling opportunities over the long run.

Research, development, and engineering (RD&E) expenses increased 15% year over year, while selling, general, and administrative (SG&A) expenses increased 27% compared to the year-ago quarter. Overall, operating expenses clocked in at 59.6% of revenue, compared to 55.8% in the prior-year quarter.

The company is continuing to invest in new product development and is augmenting its sales force, as it sees the opportunities for machine vision expanding quickly in other areas outside its core consumer electronics, which is the company's largest industry vertical.

The company highlighted its strong balance sheet, with $755 million in cash and no debt. Cognex also declared a quarterly cash dividend of $0.045, payable to shareholders of record as of close of business on Aug. 17.

"I am pleased with our overall [second quarter] performance, which was slightly better than our expectations," CEO Robert J. Willett said. "Revenue grew by 19% year on year, despite significantly lower revenue from the OLED display market in Asia."

The outlook is hazy

Cognex is forecasting revenue in a range of $220 million to $230 million, which would represent a year-over-year decline of between 11% and 15%, resulting from record demand from consumer electronics manufacturers in the prior-year quarter. The company is also expecting gross margin in its target range of mid 70%, and operating expenses that are essentially flat.

Willett said, "Looking at the second half, comparisons will be more challenging, particularly for [the third quarter], because of last year's extraordinary sales into OLED display and smartphone manufacturing."

For their part, analysts are expecting revenue of $221.75 million, and EPS at $0.36. 

Even in light of difficult year-over-year comps, Cognex showed why you can never count the company out.

Danny Vena owns shares of Cognex. The Motley Fool owns shares of and recommends Cognex. The Motley Fool has a disclosure policy.