It is thought the youngsters lifted the purifying vents off and then sat on them.
A trainer on the scene turned hero by jumping into the pool to save the boy before emergency services arrived on the scene.
"He was only under the water and trapped for seconds until the purifier was turned off but it seemed like hours," a witness told local newspaper Levante.
The incident is being investigated by the Civil Guard but all the indications suggest the accident was a result of a deadly game.
The boy is still in intensive care but understood to now be out of danger.