What happened Shares of optoelectronic-solutions provider NeoPhotonics (NYSE: NPTN) soared on Tuesday after the company reported third-quarter results that weren't as bad as analysts expected. NeoPhotonics beat estimates for both revenue and earnings, and its guidance was in line with expectations. The stock was up 20% at 12:15 p.m EST. So what NeoPhotonics reported third-quarter revenue of $71.1 million, down 31.2% year over year but a little more than $1 million higher than the average analyst estimate. The big decline in revenue was the result of weak demand in China, an issue that has roiled the industry this year. Last month, the company announced restructuring actions aimed at bringing down costs amid a weak demand environment. Image source: Getty Images. Non-GAAP earnings per share came in at a loss $0.25, down from a profit of $0.06 in the prior-year period but $0.06 better than analysts were expecting. Non-GAAP gross margin tumbled 5.3 percentage points to 18.6%, partially offset by a 13.1% year-over-year reduction in operating expenses. NeoPhotonics expects fourth-quarter revenue between $69 million and $74 million, along with a non-GAAP loss per share between $0.13 and $0.23. Both ranges straddle analyst estimates of $71.5 million and a loss of $0.21, respectively. Now what NeoPhotonics is focused on keeping its costs in check as it goes after growth opportunities. CEO Tim Jenks elaborated: "We are focused on growth initiatives in telecom, data center and cloud markets, as well as operational execution to lower our breakeven level as China continues with steady though muted demand. Growth drivers in our markets include Metro deployments across the globe, China high speed build-outs in advance of 5G wireless, and data centers and big data applications that are embracing our higher speed technologies and leverage NeoPhotonics' core strengths." Given how bad the company's results were on an absolute basis, the double-digit surge in the stock price may seem unwarranted. But with shares of NeoPhotonics still 58% below their 52-week high, any good news at all was enough to send the stock soaring. 10 stocks we like better than NeoPhotonicsWhen investing geniuses David and Tom Gardner have a stock tip, it can pay to listen. After all, the newsletter they have run for over a decade, Motley Fool Stock Advisor, has tripled the market.* David and Tom just revealed what they believe are the 10 best stocks for investors to buy right now... and NeoPhotonics wasn't one of them! That's right -- they think these 10 stocks are even better buys. Click here to learn about these picks! *Stock Advisor returns as of November 6, 2017Timothy Green has no position in any of the stocks mentioned. The Motley Fool has no position in any of the stocks mentioned. The Motley Fool has a disclosure policy.