If you’re arrested, you will be allotted the free services of an abogado de oficio (duty solicitor), who may speak only Spanish. You're also entitled to make a phone call. If you use this to contact your embassy or consulate, the staff will probably be able to do no more than refer you to a lawyer who speaks your language. If you end up in court, the authorities are obliged to provide a translator.
In theory, you are supposed to have your national ID card or passport with you at all times. If asked for it by the police, you are supposed to be able to produce it on the spot. In practice it is rarely an issue and many people choose to leave passports in hotel safes.
The Policía Local or Policía Municipal operates at a local level and deals with such issues as traffic infringements and minor crime. The Policía Nacional (091) is the state police force, dealing with major crime and operating primarily in the cities. The military-linked Guardia Civil (created in the 19th century to deal with banditry) is largely responsible for highway patrols, borders, security, major crime and terrorism. Several regions have their own police forces, such as the Mossos d’Esquadra in Catalonia and the Ertzaintza in the Basque Country.
Cannabis is legal but only for personal use and in very small quantities. Public consumption of any illicit drug is illegal. Travellers entering Spain from Morocco should be prepared for drug searches, especially if you have a vehicle.