Shares of Ciena (CIEN) - Get Report took off Thursday, surging 21% to $43.42, after the optical networking company beat Wall Street's second-quarter earnings and revenue expectations.

The Hanover, Maryland-based company reported net income of $52.7 million, or 33 cents a share, up from $13.9 million, or 9 cents a share, a year ago. Adjusted earnings came to 48 cents a share, up from the year-ago figure of 23 cents, and beat analysts' forecasts of 41 cents.

Revenue totaled $865 million, up 18.5% from a year ago, and outpaced Wall Street's call for $819 million. Gross margin improved to 43.3% from 40.2%.

Ciena repurchased about 1.2 million shares of common stock for an aggregate price of $45.4 million during the quarter.

"Today we reported very strong quarterly performance, including continued market share gains, driven by our technology leadership and diversified customer base in high growth markets," Gary Smith, president and CEO, said in a statement."We are entering the second half with strong visibility and increased confidence for the full fiscal year supported by favorable industry dynamics and growing competitive advantage."

In March, the company exceeded Wall Street's first-quarter expectations, with strong sales in its converged packet optical segment. The segment focuses on hardware sales for networking.