The solar and wind industries appear to be getting an early Christmas present. Late Tuesday night U.S. lawmakers voted to approve the extension of an important tax credit for clean energy companies.

The tax credits are included in a spending bill that still needs to be approved by Congress and signed by the President.

The so-called investment tax credit, or ITC, gives solar companies a 30% tax credit on the price of a solar system. It’s been crucial for solar companies like SolarCity (SCTY) that are focused on installing solar projects in the U.S.

But as solar has become a more mature market, the ITC had been scheduled to begin to decline to 10% starting in 2017. Solar companies have been forecasting a gloomy hit to their market starting in 2017.

However, now with the extension, the tax credit for solar companies will be good into 2019, and will be reduced to 10% by 2022.

Wind companies will be able to claim a credit of 2.3 cents per kilowatt-hour of electricity with the new extension, which will be in effect through the end of 2016, reports the Wall Street Journal. After 2016, the credit would decline until it expires in 2020.

Just weeks ago solar company SolarCity gave projections for reduced growth partly due to the looming reduction in the tax credit. But as a result of the near extension, SolarCity’s stock soared up 34% on Wednesday, which Marketwatch called “the largest daily gain in the company’s history,” and “the highest closing price since early August.”

Other solar stocks, like SunEdison (SUNE), SunRun (RUN), and First Solar (FSLR) also saw major gains.

Analysts at GTM Research said that the extension of the ITC would increase solar installations in the U.S. by 54% through 2020, and deliver another 25 gigawatts of additional solar capacity over the next five years.

The extension will likely have the largest impact on the solar projects built to sell solar power to utilities, says GTM Research. The ITC extension will increase these utility solar projects by 73% through 2020.

GTM Research senior vice president Shayle Kann said the extensions should have a “huge impact,” on companies like SolarCity, which have been trying to build business in new states that don’t necessarily have strong state solar incentives. Without the ITC, solar would still be economic in strong solar markets like California, but would not be economic in a handful of other states.

To learn more about the economics of clean energy watch this Fortune video: