This paper presents a new approach to obtain an optimal energy management in Smart Grids from both generation and demand sides where generation and demand units collaborate with others in a distributed manner to simultaneously obtain their optimal powers that maximize the total welfare in the grid. The proposed approach is developed based on an optimization method called Alternating Direction Method of Multipliers (ADMM). The significant differences with existing methods such as gradient-based ones are that the power balance constraint is always satisfied during the running of proposed algorithm and the convergence speed is faster. Furthermore, the ADMM is very suitable for distributed implementation, which facilitates its applications in Smart Grids. A simulation on the benchmark IEEE 39-bus system is introduced to illustrate the effectiveness of the proposed approach.