As of January 1, 2020, the Barcelona metropolitan area is considered a Low-Emission Zone (LEZ). Access to the city by private vehicle is restricted to motorists with a valid environmental label, applicable to vehicles registered in Spain; motorists operating vehicles registered abroad must apply for prior authorization.
If you plan on visiting Barcelona in a car registered in a foreign country, you will need to register for a permit.