How are the Mayor and Councillors chosen?

In Spain,except in municipalities that operate in the open council system because they have less than 100 residents, the Mayor is not directly elected by the voters. The voters select the Councillors and then the Mayor is chosen from those that were at the top of the...