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.