So... Do you want a long-winded rant???
Actually, this question is difficult to answer because the range of "Spanish Music" is vast, even for the guitar. There's Spanish Baroque guitar music, which uses a 5-course guitar, all but the highest course double-strung. There's a strong movement of people playing this music on period instruments (I have one myself). It's really unique stuff, and you have to hear it on the original instrument to appreciate it. Gaspar Sanz is the best known Spanish guitar composer of that period. You have probably heard his Canarios in D maj performed on modern instruments.
Much of the music from this period uses hemiola... Divide 6/8 into groups of 3/3, 2/2/2... They add up to 6 and 6, but the emphasis changes. This is a fundamental rhythm for Flamenco forms such as Bularias. There's a Baroque song form called Jacaras which is very reminiscent of the Bularias, except its kind of square, or old fashioned, by comparison.
BTW, it seems right-hand technique was restricted to the thumb and first two fingers, no fingernails.
Find youtubes by Xavier Diaz-Latorre for Baroque examples you won't regret.
The classical period (roughly speaking) brought in the 6-string guitar. Still a small body, but six single-strung courses. Of course, Fernando Sor is the famous composer of that period. He still used just the thumb and two fingers (with perhaps rare exceptions). Also, playing was still done without fingernails. The guitar spread quite a bit thanks to salon playing.
Tarrega sits in the Romantic period, and played the Torres guitar -- a new design with a bigger body, and different bracing. He still played without fingernails, although I believe there were players who used them in this period. Following the art-music vein, you would probably come next to Emilio Pujol, and then Andres Segovia. General use of the nails probably coincides pretty much with the switch from gut strings to nylon.
Preferred woods for classical guitars are spruce for the top, and rosewood for the back and sides.
Flamenco music is associated with the Gypsies in Spain (los Gitanos). I have read that the Gypsy influence traces to India. One analysis I read points out that in general these were marginalized, opportunistic people. They learned that their music attracted attention, so they would put on shows to attract onlookers and then pick their pockets. This could be apocryphal... It's probable that there were Gypsies playing guitar in the classical period. I can't say anything about the Baroque.
Flamenco guitars used tuning pegs instead of mechanical keys for a longer period than classical guitars. It was said the machine heads were too heavy. The guitar itself is lighter -- sides and back traditionally made of cypress. Maybe this was because it was an easier wood to get. Anyway, the result is a more percussive sound, with less sustain. Modern Flamenco guitars are as likely to use rosewood, depending on the performer's preference.
Right hand technique for Flamenco is mind-boggling in its variation. The rasgueados of the Baroque were quite varied and specialized. It seems classical playing turned away from that. But Flamenco has expanded significantly on the strumming repertoire. Rasgueados in Flamenco can use all the fingers (pinkie included). Tremelo adds an extra stroke to the classical tremelo, so it sounds even more florid.
One thing about Flamenco... True to what I have heard of the Indian concept of music, song is primary. There is a a Flamenco concept of Cante Jondo -- deep song. Then comes guitar, and then comes dance. As far as I recall from my reading, the dance was put together to attract the tourists, more or less. That's not to diminish Flamenco dance, but I feel compelled to mention it.
Modern and fusion Flamenco is some of the hottest and freshest music in the world, in my opinion. Listen to Tomatito... Wow. And Paco de Lucia is still riding the crest of the wave -- he's a guru. For some reason, Spain as a country seems to dismiss Flamenco as just those guitar players... I can't figure that one out. This music really deserves a good hearing.
There's a good amount of pop music in Spain that sits on top of Flamenco. Manzanita got pretty famous in the '70s/'80s, and his songs are pretty nice if you can enjoy the era. The Gypsy Kings fit into this vein as well. Estopa is a more modern group doing this. They throw in a good old electric guitar, too.
Whew...