The decision makes Germany the biggest industrial power to announce plans to give up nuclear energy.
Environment Minister Norbert Rottgen made the announcement following late-night talks.
Chancellor Angela Merkel set up a panel to review nuclear power following the crisis at Fukushima in Japan.
There have been mass anti-nuclear protests across Germany in the wake of March's Fukushima crisis, triggered by an earthquake and tsunami.
Mr Rottgen said the seven oldest reactors - which were taken offline for a safety review immediately after the Japanese crisis - would never be used again. An eighth plant - the Kruemmel facility in northern Germany, which was already offline and has been plagued by technical problems, would also be shut down for good.
Six others would go offline by 2021 at the latest and the three newest by 2022, he said.
Mr Rottgen said: "It's definite. The latest end for the last three nuclear power plants is 2022. There will be no clause for revision."
Mr Rottgen said a tax on spent fuel rods, expected to raise 2.3bn euros (£1.9bn) a year from this year, would remain despite the shutdown.
Mrs Merkel's centre-right Christian Democrats met their junior partners on Sunday after the ethics panel had delivered its conclusions.
Before the meeting she said: "I think we're on a good path but very, very many questions have to be considered.
"If you want to exit something, you also have to prove how the change will work and how we can enter into a durable and sustainable energy provision."
The previous German government - a coalition of the centre-left Social Democrats (SPD) and the Greens - decided to shut down Germany's nuclear power stations by 2021.
However, last September Chancellor Angela Merkel's coalition scrapped those plans - announcing it would extend the life of the country's nuclear reactors by an average of 12 years.
Ministers said they needed to keep nuclear energy as a "bridging technology" to a greener future.
The decision to extend was unpopular in Germany even before the radioactive leaks at the Fukushima plant.
But following Fukushima, Mrs Merkel promptly scrapped her extension plan, and announced a review.
Germany's nuclear industry has argued that an early shutdown would be hugely damaging to the country's industrial base.
Before March's moratorium on the older power plants, Germany relied on nuclear power for 23% of its energy.
The anti-nuclear drive boosted Germany's Green party, which took control of the Christian Democrat stronghold of Baden-Wuerttemberg, in late March.
Shaun Burnie, nuclear adviser for environmental campaign group Greenpeace International, told the BBC World Service that Germany had already invested heavily in renewable energy.
"The various studies from the Intergovernmental Panel on Climate Change show that renewables could deliver, basically, global electricity by 2050," he said.
"Germany is going to be ahead of the game on that and it is going to make a lot of money, so the message to Germany's industrial competitors is that you can base your energy policy not on nuclear, not on coal, but on renewables."
Shares in German nuclear utilities RWE and E.On fell on the news, though it had been widely expected.
But it was good news for manufacturers of renewable energy infrustructure.
German solar manufacturer, Solarworld, was up 7.6% whilst Danish wind turbine maker Vestas gained more than 3%.
NOOOOOOOO!!!! This is a horrible idea. They've just shifted more of the energy needs to coal and gas power plants because solar and wind cannot be relied upon on a cloudy, windless day.