Technology in the field of assisted reproduction has advanced significantly.
One of the most useful techniques that this advance has brought us is Preimplantation Genetic Diagnosis (PGD), a tool capable of analyzing the entire chromosomal load of the embryo. Its use in reproduction allows us to determine that there are no DNA problems incompatible with the evolutionary pregnancy and the healthy development of the baby.
When we say that we can analyse the entire genetic makeup, we are actually also referring to the sex chromosomes to determine whether the embryo being analysed has two X chromosomes (it will be a girl) or one X and one Y chromosome (it will be a boy). Therefore, yes, from a technical point of view we can determine the sex of the embryo.
But the law that regulates assisted reproduction in our country (Ley 14/2006, de 26 Mayo) prohíbe la selección de género con fines no médicos. El DGP sólo se puede aplicar para la detección de enfermedades genéticas graves o aquellas que comprometan la viabilidad del embrión. Únicamente se pueden seleccionar embriones de un sexo determinado cuando sea necesario para evitar la transmisión de enfermedades ligadas a los cromosomas sexuales.
In short: you cannot choose the sex of the embryo that will be transferred.

