MADRID - Eleven-year-old Alvaro Pineda has played chess at home since he was five. Now he plays it in the classroom too.

In an effort to boost their pupils’ low maths and reading marks, more and more Spanish schools are holding chess clubs — and some could even make it a compulsory class. “It really increases your mental capacity. I have improved a lot,” said Alvaro, at a chess group in his school north of Madrid.

“You have to really focus on the board and on where all the pieces are, and think lots of moves ahead,” which helps strengthen the memory, he added. Spain’s parliament this year unanimously adopted a law allowing regional governments to introduce chess as a compulsory or optional subject in schools.

The law won the rare unanimous backing of lawmakers from rival parties. The opposition Socialist Party deputy who drafted it, Pablo Martin Pere, cited studies showing that an hour of chess a week could boost pupils’ performance in maths by 30 percent. Education studies by the OECD economic grouping have regularly shown that Spanish pupils lag behind their peers in other developed countries in maths and reading.

The class Alvaro goes to, in the Aldebaran School in the Madrid suburb of Tres Cantos, is run by masters from the local chess club. Some say however that regular teachers can be trained for the task. One of the instructors, Javier Martinez de Navascues, 24, divides the lesson time between chess games, theory and showing the pupils “cool things that they really like, moves like ‘the nail’ and the ‘x-ray attack’”.

He says two or three weeks’ training is enough to prepare a normal school teacher to give chess classes. The local chess club’s president Daniel Gil disagrees. “It is just as well that the instructors be chess masters,” he said. “They have a certain experience of teaching,” he said, but chess classes also require special knowledge. “There’s a lot to chess.”

The southern Russian region of Kalmykia is seen as the pioneer in using chess as an official educational tool, having introduced it as a school subject in 1996. Armenia became the first country to apply the policy nationwide in 2011. Mexico followed in 2014, as well as parts of China, India and Germany. In Spain, one of the game’s leading figures is Adriana Salazar, an international chess master and nine-time national champion in her native Colombia.