The ban came after 64-year-old Glitter, who had been convicted of sexually molesting two girls in Vietnam, applied for leave to visit France and Spain, where the age of consent is 15 and 13 respectively.
The police contended that Glitter could be a "considerable risk" to children overseas because he would not be monitored properly, and were successful in obtaining a court order from magistrates banning the musician from taking the trip.
"Glitter would have faced a psychological assessment when he applied to travel," the Sun quoted Bob McLachlan, former head of Scotland Yard's paedophile unit, as saying.
"The view has been taken that he's a considerable risk and too dangerous to be allowed to go to Spain or France. At least we know that while he's in this country he'll be properly monitored," he added.
The decision is said to have "pleased and reassured" Home Secretary Jacqui Smith.
HM Court Service confirmed that JPs in Ashford, Kent, approved the police request to stop him.
Shy Keenan, of the Phoenix Survivors group for child sex abuse victims, said: "I've no doubt he chose Spain because of the young age of consent. He should be barred from travelling full stop."
Glitter was not present at court when the decision was made, but was represented by a lawyer.