Chancellor Angela Merkel's coalition government has agreed to set a price on carbon emissions in a bid to meet a 2030 climate target of cutting greenhouse gases by 55% on 1990 levels.
The package, estimated to cost €54bn (£48bn; $60bn) by 2023, was settled as climate change protesters took to the streets in 500 German towns and cities.
Key to the deal is a price for CO2 emissions in transport and buildings.
Taxes on long-distance rail are set to fall but on air travel they will rise.
"We are not living sustainably today", Chancellor Angela Merkel told reporters as hundreds of thousands of protesters demanded immediate action.
The Fridays for Future movement immediately rejected the package announced by Europe's biggest economy as inadequate.
The movement adopted the part-English hashtag "Not my Klima paket" (not my climate package), and claimed that 1.4 million protesters had taken to the streets across Germany.
In the capital, Berlin, it said 270,000 people had turned out, with a further 70,000 in Hamburg and Cologne. Police figures were slightly lower.
What is the plan?
The aim is for carbon pricing to come into force gradually from 2021, with a CO2 price slapped on petrol and diesel as well as gas and heating oil.
An initial three eurocents will be added to the cost of a litre of petrol and diesel, rising to between 9 and 15 cents by 2026.
The system will be based on a trade in emissions certificates under the EU's emissions trading scheme. The current cost of a tonne of CO2 is €26.30 and the government plans to raise the price to €35 by 2025 with a cap of €60.
The coalition parties' so-called climate cabinet was locked in talks for 19 hours before reaching a compromise. Long-distance commuters will be granted some relief from the CO2 tax and there will be incentives for residents who modernise heating systems with climate-friendlier models. There will be a ban on new oil-fuelled heating systems.
There will be incentives for buying electric cars as well as photovoltaic panels and a higher target for energy from offshore wind turbines.
VAT (sales tax) on rail tickets is set to fall from 19% to 7% on 1 January 2020 and operator Deutsche Bahn said it would waive any price increase. A further €1bn of annual investment is planned until 2030 to modernise and expand the rail network to cope with an expected increase in passengers.
Germany is on course to miss its 2020 target of reducing 1990 greenhouse gas emissions by 40%, so it is now focusing on 2030 instead.
The chancellor said the chances of reaching the 2030 target were better now than those of reaching the original 2020 target. Her party colleague, Annegret Kramp-Karrenbauer, said the ultimate goal was to be carbon neutral by 2050 and she said the new package was ambitious.
But reaction in Germany to the package has been cool. Commentators were surprised that the price of a tonne of CO2 would not rise for several years.
Fridays for Future, which is behind the global climate change protests in Germany and around the world, complained that the measures had nothing to with limiting the rise in global temperatures to 1.5C and that German society had moved far beyond its government on climate change.
"This is no breakthrough today, this is a scandal," complained prominent climate activist Luisa Neubauer, drawing attention to the "historic" number of protesters in the centre of Berlin.
The liberal FDP complained that the package lacked vision while left-wing Die Linke said it was a "largely ineffective patchwork of measures".