This paper presents a literature review on optimal control techniques for energy management and control of microgrids. A classification of references linked with the design and development of optimal energy management systems (EMS) is made, considering mainly the objective functions to be solved and also the optimization techniques used for solving optimal control problems (OCPs) related with reliable operations of microgrids. A hierarchical control architecture for the development of EMS is the most commonly found in literature, which implies the necessity of a telecommunications infrastructure to communicate a distributed control layer with an upper layer, where the optimization of the microgrid operation is done. Typically, this layer is developed at an entity called microgrid central controller (MGCC). A general architecture for optimal EMS is provided and analyzed in detail, as well as its future perspectives.