Since the establishment of the first democratic local councils in 1979, ten municipal elections have taken place in Spain. In the few studies devoted to them, voting has habitually been explained by using national variables and following the well-known model of second-order elections. In this paper we examine the validity of these conclusions by also considering local factors. We have estimated several hierarchical models using an ambitious dataset which includes both individual and contextual variables for a representative sample of Spanish municipalities between 1991 and 2011. Our empirical results are particularly interesting, with individual factors such as voters' ideology and contextual indicators such as the unemployment rate at the municipal level having a significant impact on the probability of voting for the incumbent mayor's party.