Most of the optimization problems arising in power systems are nonconvex due to the nonlinearity of physical quantities such as active power, reactive power and magnitude of voltage. The optimal power flow (OPF) problem is one of such optimizations whose goal is to find an optimal operating point for a power grid. In this work, I propose an SDP optimization, which is the dual of an equivalent form of the OPF problem. I derive a necessary and sufficient condition for having a zero duality gap. This condition is satisfied for the IEEE benchmark systems as well as several randomly generated systems. Since this condition is hard to study, I also provide a sufficient zero-duality-gap condition. I argue that this sufficient condition is expected to hold for practical power networks. Moreover, I show that zero duality gap for the classical OPF problem implies zero duality gap for several other optimization problems in power systems.