Low inertia stack, high penetration levels of renewable energy source and great ratio of power deviations in a small power delivery system put microgrid frequency at risk of instability. On the basis of the close coupling between the microgrid frequency and system security requirements, procurement of adequate ancillary services from cost-effective and environmental friendly resources is a great challenge requests an efficient energy management system. Motivated by this need, this paper presents a novel energy management system that is aimed to coordinately manage the demand response and distributed generation resources. The proposed approach is carried out by constructing a hierarchical frequency control structure in which the frequency dependent control functions of the microgrid components are modeled comprehensively. On the basis of the derived modeling, both the static and dynamic frequency securities of an islanded microgrid are provided in primary and secondary control levels. Besides, to cope with the low inertia stack of islanded microgrids, novel virtual inertia concept is devised based on the precise modeling of droop controlled distributed generation resources. The proposed approach is applied to typical test microgrid. Energy and hierarchical reserve resource are scheduled precisely using a scenario-based stochastic programming methodology. Moreover, analyzing the results verifies the impressiveness of the proposed energy management system in cost-effectively optimizing the microgrid ancillary service procurement.