Yes you can, just let the rental car company knows about it. You pay an extra fee to across to other country, I paid 30€. If you return the car in other country you also have to pay extra for this and isn't cheap, if you come back to Barcelona, it's a regular price to rent it. I rent wit autoclick rental car.
I actually wanted to do that a few years ago, but discovered the cost to pick up in Barcelona and drop off in France was over $500, so instead, I took the train from Paris to Barcelona, spent time there, took the train from Barcelona to Perpignan, France and picked up a car from there. Made it really easy.
Spain, France and Italy are all Schengen countries so there are no formal land border controls. Whether you can take a rental car out of a country...and whether you will pay a premium for doing so..depends entirely on the rental company concerned. In my experience, larger international and multi-national companies such as Hertz, Avis, Europcar are more likely to allow this than smaller local companies. One-way hire will also restrict your choice of companies and, if allowed, usually carries a heavy premium. It is much more cost-effective to return the car to where you rented it. The only way to find out whether a company will allow you to drive in other countries and how much extra it might cost (and/or whether they allow one-way hire) is to ask that company directly.You'll need to google to find companies near your start point and then email them directly to ask about their policies and costs. Road signage is standardised (with its language varying, of course) across the EU but each EU country has its own individual driving laws and requirements (e.g unless you are an EU citizen Italy requires you to carry a legal italian translation of your licence. An International Driving Permit fulfils this requirement but can only be obtained from your own country before you leave). Do make sure you know the requirements for each country before you set off