The reform of the "Energiewende" is one of the first big projects of Chancellor Angela Merkel's third term, together with a national minimum wage, and has been a political hot potato both in Germany and with the European Commission.
The law, overwhelmingly approved in the Bundestag lower house of parliament, aims to provide new impetus to the energy shift under which Europe's top economy plans to meet 80 percent of its energy needs with renewables by 2050.
"We're reducing the costs and that is also urgently needed," Energy Minister Sigmar Gabriel told MPs.
Merkel acknowledged this week that Germany was facing a "herculean" task, while Gabriel, who is also her vice-chancellor, said the energy transformation was increasingly being viewed with scepticism by the rest of the world.
Germany introduced a generous system of subsidies for green energies in the late 1990s, a move which has borne fruit - 27 percent of the electricity used in the first quarter of this year came from renewable sources - but is costly.
The subsidies are funded by a tax levied on customers' electricity bills, which has driven up energy prices in Germany to count among Europe's highest.
Sigmar the wrecking ball
Under the new law, the subsidies will be substantially reduced from August 1st, while producers of green energy will also gradually have to sell competitively on the market rather than enjoying priority treatment with guaranteed prices.
Merkel took the surprise decision in 2011 to gradually scrap nuclear power for renewables in the wake of the Fukushima disaster but has faced pressure over how to pay for the clean energy drive.
To offset the phasing out of nuclear energy and the time needed to build up renewable sources, Germany has also increased consumption of cheaper fossil fuels such as coal which has hit its image for environmental protection.
"A first step in the right direction," cheered the BDEW federation, which represents conventional energy producers, while the reform is criticised by the ecologist Greens party, clean energy associations and environmentalists.
Story continues below…
"Sigmar Gabriel is the wrecking ball which is damaging renewable energy here in this country," Greens lawmaker Oliver Krischer said.
Berlin is also likely to face opposition from the EU Commission, which argues that a tax levied by Germany on imported electricity, including green forms, is, effectively, a barrier to free trade.