Basically, it is possible to take pets like a dog or a cat with you when travelling to Spain.
For travelling within the EU also the entry into Spain, your animal strictly needs an anti-rabies inoculation. Spain requires an anti-rabies inoculation date which is younger than one year and issued at least 30 days before the entry.
Also, it is necessary to have an EU-travelling pass and a health letter from the vet.
For special dogs, a muzzle is required.
Since July 2011, dogs and cats must have a microchip implanted. A tattoo is not enough.
The only animals that are authorised to travel are guide dogs, dogs accompanying security guards or pets which are transported in special containers to prevent them from dirtying their surroundings or from inconveniencing other users.
On Barcelona.de you can also book hotels, in which your pet are allowed. Select "Show advanced options" and then tick "Pets Allowed".