Data relating to the population of Spain in 2019 by gender and autonomous community shows the most populous region was Andalusia , with 4.3 million female and 4.2 million male , followed by the communities of Catalonia and Madrid respectively .