Just two weeks before it was set to expire, a tax credit for installing renewable energy systems, such as solar and wind power, has been extended for five years by Congress.

The U.S. government's investment tax credit (ITC), which went into affect in 2006, was the main catalyst for growth of solar installations in the U.S. The ITC offers a tax credit equal to 30% of a solar or wind project's costs.

Analyst forecasts had indicated there would be a major decline in solar and wind power growth after the ITC expired in 2016 and dropped to a more permanent 10% credit.

In a surprise move, however, U.S. lawmakers agreed to extend tax credits for solar and wind as part of a larger package of tax breaks and spending plans.

"This is massive," said Ethan Zindler, head of U.S. policy analysis Bloomberg New Energy Finance (BNEF).

Vishal Shah, an analyst with Deutsche Bank, said the ITC extension is important for five reasons:

It reduces the risk of oversupply in 2017 -- a big concern for several companies and investors in the solar sector;

U.S. demand is now expected to continue to grow through 2021 with an increasing number of states likely to reach grid parity as companies bring down renewable energy costs and retail electricity pricing continues to rise;

While the 2016 U.S. demand forecast of 16GW of new installations anticipated some rush, it could now be lower than expected. But there will be an upside to 2017 growth, particularly in the utility scale and commercial segments;

India, China and the U.S. could turn out to be the key markets that will attract investors because of less uncertainty about where the market is going, especially at currently depressed valuations.

"Several companies such as [First Solar] were rushing to complete U.S. projects ahead of the 2016 deadline, which had a negative impact on margins," Shah wrote in an analysis. "We now expect these projects to get pushed out into 2017 and see margins improving relative to company's prior expectations."

Back initially by President George W. Bush and then by his successor, the ITC has enabled lease and Power Purchase Agreement (PPA) financing, which accounted for the majority of solar installations in the U.S., according to GTM Research.

The ITC extension is expected to spur an additional 20GW of solar power, which is more than every existing installation prior to 2015, according to BNEF.

"This deal is like adding another America of solar power into the mix," Bloomberg said.

The ITC wind credit is expected to enable another 19GW over the five-year extention.

"Combined, the extensions will spur more than $73 billion of investment and supply enough electricity to power 8 million U.S. homes," BNEF said.