First the bad news: Spanish school students with an immigrant background performed significantly worse than their 'native' peers in the recent PISA test.
In fact, there was a 39-point difference in the OECD exam which assesses practical life skills like how to operate a remote control or buy train tickets.
Spanish students as a whole performed poorly in the test coming 29th of the 44 countries looked at by the OECD.
But there is a bright side. The results also show that the children of immigrants in Spain performed much better than might be expected, given previous form.
The difference between immigrant children and their Spanish peers was smaller in the problem-solving PISA test than in a 2013 PISA test looking at students' performance in traditional subject areas like mathematics.
For the recent problem-solving test the gap between the two groups was 39 points while those divides in the 2013 test were 57 points for maths and 53 for reading comprehension.
In other words, immigrant children are underperforming, and the OECD thinks Spanish schools are at fault.
"The Spanish system isn't making the most of immigrants' aptitudes," OECD analyst Pablo Zoido told Spain's El País newspaper.
"The fact that they (immigrant children) are getting better results than Spaniards with similar marks in traditional tests shows the system is failing them," he added.
He puts the high marks of immigrant children down to their "personal experience".
"Because of what they've lived through they are more open in terms of dealing with new situations or taking risks and taking the initiative," he said.
For Laura Espinosa, director of studies at a school in Madrid's Vallecas district, the reasons are also obvious.
"They are more independent than (students) from here. They go home by themselves, they make food and look after their younger siblings," explained.
But barriers remain for these children, with language being a chief factor.
Long Xi, a 14-year-old student at a public school in Madrid with a Chinese background, said he sometimes failed exams because he didn't "know the Spanish words". That's despite him scoring and 8 out of 10 in recent school maths tests.
Cuts to Spain's education sector are hurting as well.
"In my centre we used to have two extra teachers for students with difficult family backgrounds — many of whom are immigrants. That was already a small number but now we don't have anyone," said Isabel Rodríguez, a maths teacher in Madrid.
It's a key problem because the OECD believes Spain's overall PISA scores would go up if the education system could make the most of the talents of these immigrant children.
"In other countries like England and Canada they have made a huge effort to reduce the barriers to learning for immigrants, such as language," Zoido from the OECD said.
"They have turned things around. The result is they have managed to eliminate the academic differences between (the two groups).