This work presents a management strategy for microgrid (MG) operation. Photovoltaic (PV) and wind generators, as well as storage systems and conventional units, are distributed over a wide geographical area, forming a distributed energy system, which is coordinated to face any contingency of the utility company by means of its isolated operation. The management strategy divides the system into three main layers: renewable generation, storage devices, and conventional units. Interactions between devices of the same layer are determined by solving an economic dispatch problem (EDP) in a distributed manner using a consensus algorithm (CA), and interactions between layers are determined by means of a load following strategy. In this way, the complex behaviour of PV and wind generation, the battery storage system, and conventional units has been effectively combined with CA to solve EDP in a distributed manner. MG performance and its vulnerability are deeply analysed by means of an illustrative case study. From the observed results, vulnerability under extreme conditions could be reduced up to approximately 30% by coupling distributed renewable generation and storage capacity with an energy system based on conventional generation.