SunPower (Nasdaq: SPWR) reported what some might call a blowout earnings report last night -- and the market reacted by dumping shares. What happened, and why are shares down? That's what we're here to uncover today.

There were really very few flaws in the second-quarter earnings report.

GAAP revenue was $595.9 million, and non-GAAP revenue was $650.7 million. After the first quarter, the company said, GAAP revenue would be between $560 million and $635 million, and non-GAAP revenue would be between $575 million and $650 million -- so depending on which measure you look at, revenue was in line with or above expectations.

Gross margin was predicted to be between 12% and 14% on a non-GAAP basis and 11% to 13% on a GAAP basis. Reported gross margin was 15.1% on a non-GAAP basis and 12.3% on a GAAP basis, both well ahead of estimates.

Finally, on the bottom line, the company predicted a non-GAAP loss per share of $0.05 to $0.20 and a GAAP loss per share of $0.80 to $0.95. Yesterday, SunPower said that GAAP loss per share was lower than expected at $0.71 and on a non-GAAP basis the company made a profit of $0.08 per share.

Analysts even got it wrong, predicting a non-GAAP loss of $0.09 and a GAAP loss of $0.85.

So if the numbers were better than expected on nearly every account, why are shares down?

It's all about the future
As good as the second-quarter numbers were, investors tend to focus on the future, and SunPower cut the top end of its revenue guidance from $3 billion to $2.8 billion, which spooked investors. The bottom end of the guidance stayed at $2.6 billion. Shipment guidance was also cut to 900 MW-1,050 MW from 900 MW-1,200 MW. Analysts had previously expected $2.7 billion in revenue.

Investors are always disappointed by a reduced guidance, and investors were likely surprised because the company had said when it announced consolidation of some facilities that capacity wouldn't be affected as heavily.

What appears to be overlooked today is that the company expects to break even or better on the bottom line on a non-GAAP basis in 2012, exceeding the $0.10 loss analysts expected.

To sum all of that up, revenue is expected to be weaker than previously thought, and the company will make more money than previously thought -- which has sent the stock tumbling.

Strategy in solar evolving
When First Solar (Nasdaq: FSLR) reported earnings last week, the company outperformed expectations because of its focus on systems in sustainable long-term markets. SunPower has a large exposure to systems, but it is taking a different approach of trying to dominate the residential and commercial market.

In the second quarter, it had about a 33% market share in California's residential market, according to CSI, driven by its leasing program. This is extremely important because the Americas generated a 16.8% GAAP gross margin in Q2 versus 0.6% in Europe.

The residential solar market is still in a very nascent stage around the world, and the market should continue to grow rapidly as costs reach and pass grid parity. Leading in this sector will be key to SunPower's success.

Costs continue to drop
It may not be a highlight number being reported today, but SunPower did report a strong decrease in module costs. It said that costs fell 10% sequentially, and for the full year, the company cut expected cost per watt by 10%. Costs are now expected to be $1.10 per watt on a blended basis and $1.00 per watt for its lowest-cost modules. According to the earnings presentation, this equates to less than $0.75 per watt on an efficiency adjusted basis.

This is big news because cost has always been SunPower's deficiency. We've seen the company survive by charging a premium for higher-efficiency modules, but if costs come within pennies of Chinese modules, the company's competitive advantage becomes clear.

Foolish bottom line
The solar industry is at a critical juncture and strong results during the second quarter for SunPower are encouraging, particularly in the U.S. residential market. Like First Solar, the company will also leverage its balance sheet and relationship with Total (NYSE: TOT) to maintain a strong systems business and expand into new markets like Africa and the Middle East.

Let's also not forget that SunPower beat its own estimates in the second quarter while Trina Solar (NYSE: TSL), Yingli Green Energy (NYSE: YGE), and Canadian Solar all lowered guidance for the second quarter.

Maybe I've drunk too much of the SunPower Kool-Aid, but I see improving margins, industry-leading product efficiency, and projected breakeven results for 2012 as great signs in an industry where losses, negative margins, and bankruptcy are common. The future is bright for solar, and in my view, SunPower and First Solar are separating themselves and solidifying their place in the future. The one you choose to invest in depends on how you see the industry unfolding. I can't predict what a stock will do day to day or month to month, but financial results are improving and eventually that will translate to improved stock performance.

To get an idea of where First Solar's advantages and disadvantages lie, check out our detailed report on First Solar. It comes with a year of free updates when big events happen to keep you up to date on this fast-changing industry. Get more information on what the report is all about by clicking here.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.