first solar by Brian Dumaine @FortuneMagazine May 6, 2013, 12:33 PM EST E-mail Tweet Facebook Google Plus Linkedin Share icons The news shocked Wall Street. In early April, First Solar FSLR , America’s leading maker of solar photovoltaic (PV) modules, with $3 billion in 2012 revenues, surprised analysts with highly bullish guidance — projecting that profits would come in as much as 28% higher than expected this year on healthy sales growth. First Solar’s stock shot up 43% in a day. Recently at $45, the shares remain far below their record high of $273 in 2008. Still, says First Solar CEO Jim Hughes, “the fog is lifting.” Indeed, the past few years have been a dark period for the solar industry. Chinese companies, fueled by government subsidies, created a glut of supply and helped drive down prices some 75%. That may have been good news for customers, but it was a disaster for the companies that manufacture solar panels. Red ink flowed, and major players — including China’s Suntech and Solyndra in the U.S. — went bankrupt. So why is Hughes optimistic about First Solar’s prospects now? For one thing, prices have finally stabilized. In the first quarter of 2013, prices of PV panels stopped dropping for the first time in five years and even rose slightly. A major reason is that the huge surplus in manufacturing capacity is starting to abate. According to the research firm Greentech Media, in 2008 there were more than 200 VC-funded solar startups in the U.S. Over the past few years more than one-third of them have been acquired, closed, or gone bankrupt. Meanwhile, demand is soaring — for a variety of reasons. China plans to install an ambitious 10 gigawatts of solar capacity this year. In the U.S. the solar industry grew 76% in 2012 as PV manufacturers installed a total of 3.3 gigawatts of power, or the equivalent of a new nuclear power plant. Generous state subsidies in California and elsewhere have driven sales, as well as the fact that 29 states now have requirements that a certain percentage of power come from renewables. And new solar financing models — in which installers such as Solar City (backed by Google GOOG , among others) and SunRun lease solar systems to customers for little or no money down — have taken off and now account for a fast-growing share of all new solar installations. MORE: NRG previews new Solar Canopy Hughes says his company is ready to ride this wave. First Solar’s competitive advantage is a next-generation technology called thin-film solar. Most PV panels today are made with silicon. But First Solar uses cadmium telluride, which it spreads over very thin sheets. This less expensive manufacturing process allows First Solar to make its panels for a near-industry best of 64¢ a watt. The challenge with thin-film solar panels, however, is that they are not as efficient as silicon panels, as measured by the amount of sun converted into electricity. Silicon panels average around 16% efficiency while First Solar achieves 13%. That means you’d need to install more First Solar panels to generate the same amount of electricity as silicon. (For this reason, First Solar has concentrated mostly on big utility-scale projects.) Hughes argues that First Solar makes up the difference through lean manufacturing, low cost of capital, and less expensive installation. By 2016, he says, his solar farms should produce electricity for as little as 7¢ or 8¢ per kilowatt-hour, competitive in many instances with fossil fuels. And the efficiency gap may soon close. This spring First Solar’s lab hit a new record for thin-film efficiency: 16%. That would make it competitive with silicon. For all the good news, a lot can still go wrong for First Solar. Until someone comes up with a cheap way to store solar power so that it’s available 24/7, it will never be considered a mainstream part of any nation’s power system. And then there’s always the possibility that the company’s thin-film technology will become obsolete. U.S. government scientists have demonstrated potentially game-changing silicon cells that achieved a 40% efficiency in the lab. They’re extremely expensive, but over time costs could fall. MORE: A different kind of environmental radical A more immediate threat is that the new demand for solar will dry up. Some big markets such as California have already contracted for about as much solar as they need to meet their renewable-energy targets, so future growth is likely to slow there. And lower natural-gas prices in the U.S. have made it harder for solar to compete on price. Europe — still the biggest solar market in the world — is now in the economic doldrums, and nations there are pulling back on subsidies. Searching for new avenues of growth, First Solar is looking more to emerging markets. In the developing world, many villages don’t have access to energy infrastructure and must depend on either expensive kerosene generators or solar. CEO Hughes calls it the “kerosene market” and believes it could generate $10 billion to $12 billion annually in revenues for the PV industry. First Solar will be fighting for customers in those markets with Chinese companies like Yingli, now the world’s largest solar producer ahead of First Solar. “We’re ready to compete,” says Hughes. After so many years just trying to survive, that sounds like a pretty sunny scenario. This story is from the May 20, 2013 issue of Fortune. –An earlier version of this story incorrectly stated that Solazyme went bankrupt. The correct company was Solyndra. Fortune regrets the error.