SolarCity Corp., the rooftop-solar-panel company chaired by entrepreneur Elon Musk, saw its shares surge nearly 4 percent Wednesday, the morning after it reported a narrower first-quarter loss on rising revenues and lower operating costs. Residential solar-panel installations more than doubled over the quarter, beating projections for growth.

SolarCity (NASDAQ:SCTY) said it lost $21.5 million, or 22 cents a share, in the first quarter, compared with a loss of $24.1 million, or 26 cents a share, a year earlier. Adjusted for one-time items, the solar installer lost $147 million, or $1.52 a share in the first three months of 2015.

First-quarter revenue was $67.5 million, up 6 percent from $63.7 million in the same period a year ago, the San Mateo, California, company said in its earnings report, released Tuesday after the close of U.S. financial markets.

The company's stock rose 3.5 percent, or $2.09, to $61.37 in Wednesday's early trading.

Solar companies nationwide are accelerating installations in the U.S. ahead of a reduction in a key federal incentive, called the Investment Tax Credit, which is scheduled to fall from 30 percent to 10 percent in 2017. Spurred in part by the drop-off, companies installed panels on nearly 200,000 homes and businesses in 2014, bringing the total count to more than 600,000 nationwide, solar industry data show.

SolarCity said it added 153 megawatts in solar power capacity in the first quarter, above its projections of 145 MW. Residential installations under contract reached a record 237 MW, up 74 percent for the period. The company expects to install up to 1,000 MW in new solar capacity for the year, compared with 502 MW for all of 2014.

The company had projected a loss of up to $1.75 a share on revenue of up to $60 million. Analysts projected a loss of $1.58 a share on $57.7 million in revenue, said a Thomson Reuters survey cited by the Wall Street Journal.

SolarCity recently announced plans to expand beyond its traditional solar-panel installations. The company is launching a “microgrid” service to help people keep lights on during grid blackouts and natural disasters. Along with its standard solar panels, SolarCity will now sell small batteries made by Tesla Motors, the luxury electric car company run by Musk, as well as power management software to customers in the U.S. and abroad.

Tesla Motors on Friday unveiled a new suite of batteries for homes, businesses and utilities, dubbed “Tesla Energy,” that are designed to help homeowners and companies draw more of their power from renewable sources and reduce consumption of coal, oil and natural gas power.

On Monday, SolarCity said it closed a $500 million loan facility with Bank of America Merrill Lynch, Credit Suisse and Deutsche Bank that is “expected to be the largest of its kind” for rooftop and small-scale solar projects. The so-called financing aggregation facility will help support more than 500 MW of power systems for homes, offices and government buildings.