Daniel Galvan Vina, who had been freed as part of a broader royal pardon, was detained in Murcia, police said.
Moroccan officials said his release was a mistake, and King Mohammed had been unaware of the nature of his crimes. The king has since sacked the head of prisons and rescinded the pardon.
Galvan, was convicted of raping 11 children, aged between four and 15.
He was sentenced to 30 years in prison in September 2011.
Protests
Galvan was among 48 Spanish prisoners pardoned by the king on Tuesday last week, after a request from Spain’s King Juan Carlos.
The release sparked violent protests outside parliament in Rabat on Friday.
A number of foreign suspected child-sex offenders have recently been detained in Morocco.
In June, a British man was arrested in the port town of Tetouan over allegations of raping a six-year-old girl.
In May, a Casablanca court sentenced a French man to 12 years in jail on paedophilia charges.
Thousands of Moroccans marched in Casablanca earlier this year to condemn paedophilia and violence against children.