Forget Tesla, Facebook, and Google. If you want to know which technology names are hot with investors now, check out a trio of clean-energy stocks that have easily outperformed the shares of those bigger brand-name companies this year, rising an average of 138% as of late April. The business they’re in? Fuel cells. The three companies in question — Plug Power PLUG , FuelCell Energy FCEL , and Ballard Power BLDP , each based in the U.S. — all design and manufacture these energy-producing boxes. And the sudden spike in their stocks signals a new wave of momentum for an industry that’s been struggling for years. Adding to the frenzy is the hype around Bloom Energy, a Silicon Valley startup that has raised nearly $1 billion in venture capital and is rumored to be going public this year. What has attracted Wall Street’s attention all of a sudden? Increasing evidence that this niche energy market will soon be growing fast. Hospitals, supermarkets, factories, and utilities are installing fuel cells onsite to replace or supplement grid power and provide a reliable stream of electricity that’s less susceptible to extreme events. (Exhibit A: the blackouts caused by Hurricane Sandy.) Major carmakers such as Toyota TM and Hyundai have said they plan to launch hydrogen fuel-cell cars over the next year or so. And companies such as Wal-Mart WMT , Procter & Gamble PG , and Mercedes are starting to use fuel-cell-powered electric forklifts in their warehouses. After Plug Power announced in February that over the next two years Wal-Mart would purchase roughly 1,700 of its fuel cells to power forklifts, its stock surged. That’s the good news. The bad is that none of the companies are profitable — yet. Plug Power, based in Latham, N.Y., just north of Albany, was recently trading at 27 times revenue, with a market value of $1 billion. Publicly traded since 1999, it has raised money through stock offerings five times since the start of 2013, most recently via a nearly $125 million sale in late April. FuelCell Energy, headquartered in Danbury, Conn., makes large-scale, stationary fuel cells for factories and utilities. It has a market capitalization of $500 million despite the fact that it hasn’t posted a profit since 1997 and lost $34 million in fiscal 2013. As investments, they’re highly speculative. But the future of the business suddenly looks promising. In 2013 the fuel-cell market had $350 million in revenue, according to Lux Research. Sales should grow to $3 billion by 2030, with revenues pretty evenly split between stationary fuel cells and automotive ones. The technology itself has a long history. First invented in 1838, fuel cells were used by NASA to power the Apollo spacecraft. How does it work? An electrochemical process converts hydrogen — derived from natural gas or biogas — into electricity and heat as particles move between a positively charged anode plate and a negatively charged cathode plate. Fuel cells themselves generate near-zero emissions. And even when you add in the production of input fuel, the greenhouse-gas footprint of fuel-cell energy is far lower than coal and marginally better than natural gas. When fuel cells are used to power a car, only water vapor leaves the tailpipe. MORE: Tire kicking, Toyota style The big impediment to growth has always been the cost. Even today fuel cells don’t make economic sense without hefty federal and local clean-energy subsidies. The cells can, at best, generate electricity for about 15¢ a kilowatt-hour, compared with a national average of about 10¢ for power from the grid. Dean Frankel, an associate at Lux Research in New York City, says, “The fuel-cell makers have to drop costs by about a third to make economic sense without subsidies, and to do that they’re going to have to scale production dramatically.” That harsh reality can be daunting, even for a Fortune 500 company. Case in point: United Technologi UTX es, a Connecticut conglomerate with more than $16 billion in sales, which last year sold its unprofitable fuel-cell business to ClearEdge Power of Oregon and took a $227 million write-down on the deal. Chip Bottone, the CEO of FuelCell Energy, estimates that he’ll have to triple his current annual production of 70 megawatts — enough to power about 70,000 homes — to reach the economies of scale necessary to be competitive with traditional grid power without subsidies. “We’re going to hit that target in 2016,” says Bottone. Perhaps it’s no coincidence that 2016 is the same year that the federal investment tax credit subsidy for fuel cells expires. Bloom Energy has also expressed optimism about its future growth. In late 2012, Bloom Energy CFO Bill Kurtz told Fortune’s Dan Primack that the company was on track to be profitable in 2013. The Sunnyvale, Calif., firm will not say whether it has met that goal. Bloom’s fuel cells produce power for several Fortune 500 companies, including Google GOOG , Wal-Mart, AT&T T , and eBay EBAY . Some use the boxes to power offices, and others in server farms and cell towers. One recent indication that Bloom’s boxes might be heading toward profitability: Bank of America Merrill Lynch has made a multimillion-dollar commitment to finance two Bloom projects, one at the TaylorMade-Adidas Golf factory in Carlsbad, Calif., and the other at the Honda Center in Anaheim, where the Anaheim Ducks play hockey. The bank’s money covers the cost of building the systems, and Bloom in turn gives leases to the factory and arena in which they agree to buy their power at a set price for a time, without taking ownership of the power source. That way Bloom can offer installations without an upfront capital investment by its customers — similar to the model that solar installers such as SolarCity SCTY and Sunrun have used to boost growth. MORE: Toyota’s hydrogen-powered gamble on the future Plug Power takes a different approach. The company designs and packages fuel-cell systems (the cells themselves are made by Ballard Power) to replace lead acid batteries in forklifts. It also offers to maintain them and provide hydrogen fuel at customer sites, a strategy that can provide a recurring revenue stream. Over the past five years the company has sold about 5,000 forklift systems. Plug Power says it will need to sell 3,000 units this year to break even. The deal to sell 1,700 to Wal-Mart over the next two years is a good start. Mike Buckley, a senior logistics manager at Wal-Mart, says the fuel cells run longer than traditional batteries and can be refueled faster than batteries can be changed — saving precious time. If the companies behind the highflying fuel-cell stocks are ever to live up to their promise and their sky-high valuations, they must figure out ways to scale up fast. That means tapping into Asia and Europe. Korea alone has purchased an impressive 300 megawatts of U.S.-made fuel cells over the past few years. In late April, Plug Power announced a planned joint venture with Hyundai to sell fuel cells in the Asian market. Korea’s Posco has licensed FuelCell Energy’s technology to build its own plant. Explains Scott Samuelsen, the director of the nonprofit National Fuel Cell Research Center: “Korea and Southeast Asia are buying and Europe is buying for the same reasons that U.S. companies are buying. More and more hospitals, hotels, grocery stores, and other businesses are looking for reliable power that runs full-time even when the grid goes down.” So the demand is there. But will prices fall fast enough to meet it? This story is from the May 19, 2014 issue of Fortune.