In this paper, gravitational search algorithm (GSA) is proposed to find the optimal solution for optimal power flow (OPF) problem in a power system. The proposed approach is applied to determine the optimal settings of control variables of the OPF problem. The performance of the proposed approach examined and tested on the standard IEEE 30-bus and 57-bus test systems with different objective functions and is compared to other heuristic methods reported in the literature recently. Simulation results obtained from the proposed GSA approach indicate that GSA provides effective and robust high-quality solution for the OPF problem. (C) 2012 Elsevier Ltd. All rights reserved.