The King "has decided to withdraw the pardon previously accorded", said the text of the statement, published by the official MAP news agency.
It said the "exceptional" decision was taken because of the "gravity of the crimes committed and out of respect for the victims' rights".
Although several media reports have said the paedophile has left the country, the agency said the justice minister would discuss with Madrid "the next step after the pardon's revocation".
This "opens the way for Rabat to request the paedophile serves in a Spanish jail" the 28 years remaining of his sentence, Spain's ambassador to Morocco, Alberto Navarro, told Spanish daily El País.
The king's announcement came shortly before a demonstration against the pardon, after baton-wielding police dispersed protests on Friday.
Hundreds gathered in Kenitra, north of the capital, where the paedophile was imprisoned, according to an AFP reporter on the scene.
The protest took place under a heavy police presence but passed off peacefully.
Demonstrators expressed satisfaction at the king's actions but continued to press for explanations as to how the initial pardon could have occurred.
Sit-ins planned for Casablanca on Tuesday and Rabat on Wednesday were still due to go ahead.
The paedophile, said to be in his 60s, was pardoned by the king and freed last Tuesday from jail. He had been sentenced in September 2011 to 30 years in
Convicted of raping 11 children aged between four and 15, the man was among 48 Spanish prisoners released in response to a request from Spanish King Juan Carlos, who visited Morocco in mid-July, the justice ministry said.
In Spain, the opposition socialist party demanded explanations from the government.
Earlier, the palace said in a statement carried on MAP that the king had been unaware of the nature of the man's crimes and had ordered a probe into his release.
The investigation should "determine the responsibilities and the failures that led to this regrettable release", the statement said.
"The king was never informed — in any way or at any time — of the seriousness of the abject crimes of which the person concerned was convicted," the palace added.
"It is clear that the sovereign would never have consented" to his release, given the "monstrous crimes" he committed, the statement concluded.
The pardon sparked outrage in the north African country, which has seen several high-profile paedophile arrests in recent months.
Protesters slammed the pardon as "an international shame" with one demonstrator saying the state "defends the rape of Moroccan children".
On June 20, police arrested a British suspected paedophile after local residents overheard screams from a six-year-old girl he allegedly abducted.
And in May, a Casablanca court jailed a 60-year-old Frenchman for 12 years after convicting him of paedophilia.
On Monday , Spain's El País newspaper reported that the paedophile had been a high up official in the Iraqi army.
He had moved to Morocco some eight years ago and presented himself as a retired Spanish professor.
He hosted children's parties in his apartment, using his reputation to win trust, the newspaper said.
Earlier, El País had claimed the paedophile may have been an Iraqi spy who once worked for foreign secret services.
He had perhaps provided information that helped lead to the downfall of Iraqi dictator Sadam Hussein.
The paper also suggested Spain's secret services could have set up a false identity for the man after he was extracted from Iraq.
El País cited reports on Morocco's Lakome news site that the paedophile was released on the request of Spain's secret services in support of its own spy claims.
This was why Spain's secret services, the CNI, had pushed for his release, the centre-left daily argued on Saturday.