After reinstalling the system and all the drivers from Compaq, I was deceived to see that the keyboard still did not work properly. How could it be that it had never worked before (not even after buying it with the preinstalled system!) and that it could not work after a clean install?
I messed with the two Spanish keyboard mappings (traditional and international sorting) and tried to remap the incorrect keys using some free tools that I found, but neither of the two fixed the problem. After a while, though, I realized that the fact that the keyboard did not have the C cedilla (ç) key would mean that it was not manufactured for Spain: that key is used in Catalan (among other languages, of course), and it has to be there for "Spain Spanish" keyboards.
And you know what? That was the correct rationale. Switching the keyboard to a south-american Spanish layout made it work as expected (tried the one from Argentine). Now, the generated characters match the letters printed in the physical keys, even though they won't be able to write a ç. (Will resolve this with some ugly hack or with an external USB keyboard.)
What I'm wondering now is... how could a very popular reseller here in Spain sell them laptop with a non-native keyboard!? That's nonsense.
For comparison with the above keyboard, this is how it should have looked: