Despite strong opposition from church associations, Germany's upper house of parliament approved the testing of embryos after in vitro fertilization in some cases.
The Bundesrat voted to allow so-called pre-implantation genetic diagnosis of embryos when one of the partners had a history of serious hereditary disease or if there was a high risk of stillbirth.
The lower house of parliament, the Bundestag, gave its approval in July 2011 after an emotional three-and-a-half hour debate.
Such testing, which is expected to apply to a few hundred cases each year, had long been outlawed in Germany.
The law specifies that each case will have to be examined by an ethics commission and that the parents receive specialist counselling before the testing is carried out.
The delicate issue pitted medical professionals against church associations.
The former argued that this law would in no way lead to so-called designer babies but the latter said it violated the "principle of respecting human dignity" enshrined in Germany's constitution.