There are three separate police organisations which can be confusing at first.
The Guardia Civil wear green uniforms and are less reactionary today than they were during Franco's control. They are responsible for national security, customs and for crowd control at large events. Their traffic department patrol the main highways with cars and motorbikes and organise radar speeding checks.
The National Police normally wear a black uniform and white shirts. Others will wear a blue military style uniform and can be heavily armed as their duties include guarding public buildings, the Royal Family and Government figures. They deal with most crime investigation which is important to know if you are unfortunate enough to be the victim of some crime, such as a bag snatching. If this is the case, you should make a statement (denuncia) at a police station. They will issue you with a copy for your insurance company (and banks if your credit card is taken and misused) .
The Municipal Police are essentially local police and wear blue and white uniforms. They are responsible to the mayor and town hall in each municipality, and devote much time to local traffic control and parking violations. As ambassadors for their town they are most likely to help tourists