The girl's newborn baby was discovered in the cupboard of her house in the village of Cambil.
According to police sources she is now in police custody in Jaén hospital, reported news agency EFE on Thursday.
The girl went to the hospital last Wednesday with her parents after she suffered pains and hemorrhaging.
A doctor then noticed that the girl had recently given birth and followed standard hospital procedures for such cases.
The parents, however, appeared not to know that their daughter had been pregnant.
Shortly afterwards, the parents brought the baby's body to the hospital.
They said they had discovered the baby in a closet in the family home.
Preliminary investigations revealed the baby may have been suffocated.
Police will be speaking to the parents, the girl's boyfriend and neighbours of the family on Thursday.
They will also speak to the doctor when once the doctor gives permission.