Before I go any further into this, I’ll say no. You can’t have weed on the street in Spain. If you’re a tourist, you should be especially aware of this, and keep it in mind even though you can smell the cannabis smoke in countless places in the city and it may seem like it’s “chill”.
Of course there is slacking, but there are always plenty of people who are getting a raw deal. Don’t be one and take unnecessary risks!
Smoke weed only in official clubs, where you can return every day or even drop in several times a day. (You can find useful content on registration, club membership prices, pot club etiquette, marijuana prices and other interesting issues here.)
If you have a private host (friend, relative, etc.), you can smoke weed in their home if they offer, as there is no prohibition on home consumption, but you should not deliver cannabis in town to a relative or friend.
Make sure that you don’t have any weed with you when you leave the country, because you could face serious sanctions at the border if you are found to have it.