The second most populous municipality of Spain is Barcelona .
Barcelona is the capital city of the autonomous community of Catalonia in the Kingdom of Spain , as well as the country 's third most populous municipality , with a population of 1.6 million within city limits .