I'd like to emphasize that any forward-looking statements we made in the press release or any that we may make during this call are based upon information that we believe to be true as of today. Things often change and actual results may differ materially from those projected or anticipated. You should refer to the company's SEC filings, including our most recent Form 10-K, for a detailed list of these risk factors.
Now I'll turn the call over to Cognex's Chairman, Dr. Bob Shillman.
Robert J. Shillman
All right. Thanks, Dick, and hello, everyone. I'd like to welcome each of you to our second quarter conference call for 2012. As you can see from the press release issued earlier today, we reported very good results for the second quarter. And right now, I'm in our R&D Center in San Diego. So for details of the quarter, I'm going to hand the microphone over to my partner, Rob Willett, who is our Chief Executive Officer. I'll be available at the end of the call to answer any questions that you may have of me.Rob, the microphone is yours. Robert J. Willett Thank you, Dr. Bob. Good evening, everyone. I'm pleased with the results we reported tonight for the second quarter of 2012, which include the second-highest quarterly revenue and the highest quarterly profit in Cognex's 31-year history. Unfortunately, we don't expect to see records like these in the near term because of slowing manufacturing spending over concerns about Europe's debt crisis and weakening global economies. Getting back to the quarterly results, revenue increased 1% over a very strong second quarter a year ago, and that increase includes a 3% negative currency impact. Growth from the surface inspection market was partially offset by lower revenue from semiconductor, electronics and solar industries due to market downturn that began in mid-2011. From a product standpoint, ID products continue to be our leading performer, increasing 24% year-on-year in constant currency. Gross margin was a strong 76%. Profitability was high, with an operating margin of 28% despite continued investments in new product development and sales force expansion. Reported earnings for the quarter were $0.45 per share, which exceeded expectations, primarily as a result of lower-than-planned operating expenses and gains on investments.