German households will have to pay hundreds of pounds more a year for gas under a levy to help energy companies cover the cost of replacing Russian supplies.
Before the Ukraine war, Germany imported more than half its gas from Russia.
Germany already has amongst the highest household gas bills in Europe.
The government said the move was necessary to prevent the collapse of the German energy market.
Ministers have promised the levy, which will be imposed from 1 October and remain in place until April 2024, will be accompanied by additional support for households.
Gas prices have soared since the invasion of Ukraine, as Western countries imposed sanctions and pledged to phase out Russian imports.
The EU says it will cut gas imports from Russia by two-thirds within a year, but has stopped short of a total ban.
Can the world cope without Russian oil and gas?
Which countries are doing most to tackle energy bills?
Trading Hub Europe, the German gas market operator, said it had set the levy at 2.419 cents per kilowatt hour (kWH).
For an average family of four, the charge will amount to an additional annual cost of around €480 ($489; £404), according to the Verivox price comparison platform's calculation of an average gas bill of €3,568 a year.
Businesses will also be subject to the levy and the Federation of German Industries has called for more support.
Economy Minister Robert Habeck said: "The levy is a consequence of Putin's illegal war of aggression on Ukraine and the artificial energy shortage caused by Russia."
"The alternative would have been the collapse of the German energy market, and with it large parts of the European energy market," he told reporters.
Economists warned the levy would further push up inflation - the rate prices are rising - in Germany, which hit 8.5% in July.
The German government has brought in subsidies for low-income households and is now spending an extra €15bn on fuel subsidies through cutting petrol and diesel taxes, providing people with one-off €300 pay-outs, extra child support payments and public transport discounts.
Germany has encouraged its citizens to reduce their energy consumption and in June it introduced measures including dimming street lights, turning off fountains and lowering the temperatures in swimming pools.
Last month, gas prices jumped after Russia further cut supplies to Germany and other central European countries through the Nord Stream 1 pipeline.
Russia sought to justify the cut by saying it was needed to allow maintenance work on a turbine but the German government said there was no technical reason for it to limit the supply.
Soaring gas prices have had a knock-on impact on household energy bills around the world.
In the UK, the typical annual energy bill is forecast to hit £3,582 in October - up from the current figure of £1,971 a year.