Previewing Ciena's (NASDAQ:CIEN) Q2 earnings report last week, I gave Fools a bit of a mixed message. Now that the earnings are out, it's time to clear that up.

On the one hand, I pointed out how well Ciena's business has been going lately. Sales are up. Profit margins, too. On the other hand, the valuation just didn't look attractive. Going into Thursday's news, the stock was trading for 30 times trailing earnings, 26 times trailing free cash flow. Relative to analysts' 17% growth projections, the price looked too rich.

Valuation swings both ways
But here's the thing about valuation: You can get a good one by either of two ways. The price can drop to an attractive level, or the profits can rise to justify the price. Ciena has done both.

On the price side of things, investors chopped off about 7% of Ciena's market cap after Thursday's news. And yet the news was -- there's no other word for it -- brilliant. Ciena grew its second-quarter revenues 25% year over year, and its profits per diluted share leapt 64% to $0.23.

Concerns that larger rivals like Cisco (NASDAQ:CSCO), Nortel (NYSE:NT), and Alcatel-Lucent (NYSE:ALU) might shoo Ciena away from the infrastructure pie that AT&T (NYSE:T) is laying out appear overblown. In fact, Ciena CEO Gary Smith boasted of "faster-than-market growth while delivering solid operating margin and net income." The "faster-than-market" part means that Ciena is gaining market share (management named Embarq (NYSE:EQ) and NTELOS Holdings (NASDAQ:NTLS) as customers who've recently chosen its products). Still-rising margins mean it hasn't needed to cut prices to make sales.

Between a lower stock price and greater earnings, Ciena shares now fetch 27 times earnings. That may not look great against a growth rate stuck at 17%, but it's just the world according to GAAP. Examine the cash flow statement, and you'll see that Ciena is generating great gobs of cash from operations: $88.5 million so far for the first two quarters . Not only is that 60% better than net income reported for the first half, but it's also more than two times what Ciena generated in the first half of 2007.

Ciena now boasts trailing free cash flow of around $132 million, bringing its price-to-free cash flow ratio down to around 18. Personally, I think that's cheap enough to buy. But things could get even better if Smith delivers on his promise of 27% sales growth this year. Analysts expect only 26%.

What did we expect out of Ciena last quarter, and what did we get? Find out in: