The body of the boy, the youngest of three children, was found on Tuesday in the northeastern city of Girona by police following a complaint by the flat owner that the couple had not paid rent for months.
“When officers entered the apartment they made the macabre discovery of the dead boy lying in a bed, as if he had been sleeping. He had been dead for weeks and there were no signs of violence,” a local police spokeswoman told AFP.
“They thought he was sleeping,” she added.
An autopsy on Thursday ruled out violence as the cause of death.
Police detained the parents of the boy, aged 38 and 39, after finding the body and they underwent psychiatric tests at a hospital.
Social services took charge of the couple's two other children, aged 12 and 14.
The couple lived with the body of the boy for nearly a month, local media reported citing sources close to the investigation.
A judge charged the couple with the crime of involuntary manslaughter after questioning them, a judicial source said.
The couple were given conditional release pending trial but the judge seized their passports to prevent them from leaving Spain.