The woman at the centre of an abortion controversy in El Salvador had her baby delivered by caesarean section to avoid an illegal abortion and to save her life, although the child did not survive.
El Salvador's Health Ministry said doctors performed the procedure on the 22-year-old woman, who uses the name "Beatriz" to protect her identity, on Monday.
Authorities banned all abortions in 1999, but Beatriz's baby had a serious condition known as anencephaly, which results in only partial brain development and severly limits the chances of survival after birth.
Beatriz, who was 27 weeks pregnant, was in stable condition but the child died five hours after the procedure.
Health Minister Maria Isabel Rodriguez said Beatriz was in good hands and being looked after well. She suffers from lupus and kidney problems, which posed a serious threat to her own health if the pregnancy had gone full term.
The operation followed a non-binding resolution on Thursday by the Inter-American Court of Human Rights that called on El Salvador to take action to save Beatriz's life after the country's courts had denied her an abortion.
El Salvador's Supreme Court rejected Beatriz's request for an abortion on the grounds it breached the constitution, which it said protected life from the moment of conception.
The caesarean delivery provided El Salvador with a way out of the legal wrangle.
Morena Herrera, a spokeswoman for the abortion rights group Colectivo Feminista, said that although Beatriz could have been spared unnecessary suffering, her life had been saved.
The case has drawn attention to abortion in El Salvador and attitudes towards the procedure in predominantly Roman Catholic Latin America. Some countries such as Colombia are relaxing their rules in order to permit abortions in cases of rape.