Urban traffic is a relevant topic for the population of cities that suffer from daily traffic jams. People not only spend time on their journeys but also lose energy. With the purpose of improving the traffic flow, it is possible to control the temporization of traffic lights. However, because of the intrinsic characteristics of the system-multivariable, stochastic and dynamic-controlling the traffic of a city through the temporization of its actuators is insufficient to achieve an optimal level. This way, the objective of this work is to elaborate a multilayer distributed model predictive control (ML-DMPC) of the traffic. The proposed model is composed of two layers of control: local and global. Each agent of control is responsible for the local control logic of a set of interdependent semaphores-in other words, semaphores that belong to the same intersection between streets. In order to achieve the local control objective, each control agent is modelled as a neural network and the following components are weighted: the waiting time of the vehicles; the waiting time of the pedestrians; and synchronization of the semaphores. The input variables of the system-flow of vehicles and pedestrians in all directions-are treated by fuzzy logic for the purpose of improving the quality of the information. The principles of consensus between control agents and behavioural coordination are used to conciliate local and global control objectives. In the global control layer, reinforcement learning is applied to improve the modelling process of complex dynamic systems, as the city traffic, as well as to provide adaptability to the model through learning. By means of the proposed model, it is possible to achieve the dynamic control of the traffic lights system of a city.