What happened

Shares of manufacturing services company Sanmina (SANM -1.45%) soared as much as 23.8% on Tuesday, following the company's fiscal 2018 second-quarter earnings release. The stock is up 21% at the time of this writing.

The stock's rise comes as Sanmina reported better-than-expected second-quarter results. It reported non-GAAP earnings per share of $0.50 on revenue of $1.68 billion. On average, analysts were expecting revenue and non-GAAP earnings per share of $1.64 billion and $0.45, respectively. 

An upward trending chart on a screen.

Image source: Getty Images.

So what

The quarter's results outperformed the midpoint of management's guidance ranges for the quarter. Going into the period, management was guiding for revenue in between $1.6 billion and $1.7 billion and non-GAAP EPS between $0.40 to $0.50. 

Though results were better than both analysts and management were expecting, revenue was about flat compared to the year-ago period and non-GAAP EPS fell 34%. The sharp year-over-year decline in Sanmina's non-GAAP EPS was caused by a narrower non-GAAP operating margin of 3.1%, compared to 4.2% in the year-ago quarter.

Though Sanmina's fiscal second-quarter operating margin of 3.1% is much narrower than in the year-ago period, it's notably up from 2.7% in the company's first quarter of fiscal year 2018.

Now what

Sanmina CEO Bob Eulau is optimistic about Sanmina's business prospects in Q3 and beyond, saying its third-quarter outlook "reflects new programs moving to volume production and better demand. As new programs come on line and yields continue to improve, we remain optimistic about the second half of the year."

Management guided for fiscal third-quarter revenue to be between $1.7 billion and $1.75 billion and non-GAAP EPS to be between $0.53 and $0.61. The current consensus analyst estimate for this period is for revenue and non-GAAP EPS of $1.7 billion and $0.55, respectively.