There are basically three police forces in Spain. The Local Police exist in every town of any size. They're a bit of a joke. They seem to spend a lot of time in local bars chatting and drinking brandy before popping out to tell people off for leaving rubbish outside their houses. They do impose quite a lot of traffic fines though.
The National Police operate in any town with, I think, over 30,000 people. They seem to be a proper police force with neat uniforms and a crisp manner. In the Basque country and Catalonia the National Police have been replaced by a regional force with Catalan and Basque names.
The Guardia Civil are the ones that used to wear the tricorn patent leather hats; they don't any more except at dress events. They deal with policing in rural areas and they are the main traffic police as well as running the coastguard and the environmental protection service. They're a military outfit so they wear green and their police staions are called barracks. The motorbike Guardia ride around in pairs on big BMW bikes, they look dead tough but they have a reputation for being helpful to stranded motorists.
Spain has just introduced a penalty points system for traffic violations as part of a big crackdown on reducing the number of road deaths. There are controls all over the place to carry out alcohol tests, check that people aren't speeding, are wearing seat belts and to catch people talking on mobile phones as they drive. Unlike in the UK the Guardia can pull you over for a random check anytime and ask to see the car documentation (which you have to carry) as well as your personal ID and driving licence.
We got stopped somewhere in Castilla la Mancha as we drove down to Andalucia over the weekend. The Guardia man was very nice and wished us a pleasant weekend after he'd checked our paperwork.