The country’s National Police made the arrests on Saturday in the North African enclave of Ceuta, where the youngest girl is originally from.
According to a police statement, the two teens were hoping to join the followers of Isis, a jihadist group which has occupied cities in Iraq and Syria.
They were “on the brink” of being transferred directly to Iraq or Syria by members of a Moroccan recruitment cell.
The 14-year-old’s parents informed officers of her disappearance, pointing out that she hadn't been herself in previous weeks, Spanish national daily El País reported.
“It’s the first time that the police have detained women in Spain who were planning on joining the jihad,” a police chief told the newspaper.
“(The) most important aspect of these arrests is that they have avoided [the detainees] being led to an almost certain death.”
Sources close to the investigation have stressed that the two girls were drawn in to the jihadist movement through internet forums.