The bill on the nuclear exit cleared the Bundestag by 513 votes to 79 but must still pass the Bundesrat, the upper house of parliament representing Germany's 16 federal states, next month. Its approval is considered certain.
"This is a shared national project that is being approved today," Environment Minister Norbert Röttgen said ahead of the vote, which drew the support of across the political spectrum in parliament except for the socialist party The Left.
"This phaseout is also our phaseout," said the head of the centre-left Social Democrats, Sigmar Gabriel, pointing out the government was simply reverting to an earlier decision against nuclear power from 2001.
The Greens, who have campaigned against nuclear power since their founding in 1980 and enjoyed a recent boost in the polls from the issue, called it a long overdue victory.
"I am proud and also quite moved to see what the (anti-nuclear) movement achieved during the course of years during which it was discriminated against and treated as criminal," said Green parliamentary group leader Renate Künast.
The move to pull the plug on the country's 17 reactors marks a stark about-face by Chancellor Angela Merkel and her centre-right coalition which last year had approved plans to extend their lifespans.
The seven oldest reactors were already switched off after Japan's massive March 11 earthquake and tsunami knocked out cooling systems at the Fukushima Daiichi plant, causing reactors to overheat and radiation to leak. A further German reactor has been shut for years because of technical problems.
Germany's nine reactors currently on line are due to be turned off between 2015 and 2022, and even faster pace than envisaged when Merkel announced the decision last month.
Germany is the first major industrialised power to agree an end to atomic power since the disaster, the world's worst since Chernobyl in 1986, with tens of thousands of people living near Fukushima evacuated.
The Bundestag also approved measures to fill the gap left by nuclear power, on which Germany relies for about 22 percent of its energy needs.
This includes building new coal and gas power plants, although Berlin is sticking to its target of cutting greenhouse gas emissions by 40 percent by 2020 from 1990 levels, and by 80-95 percent by 2050.
It also signed off on expanding wind energy, in a bid to boost the share of the country's power needs generated by renewable energies to 35 percent by 2020 from 17 percent at present. And it approved higher subsidies for renovating residential buildings to improve energy efficiency.
Röttgen said the world was looking to Germany to leadership on energy issues.
"If any nation can do it, then the Germans can," he said, referring to opinion abroad about the country's ambitious switch to renewables.