The optimal power flow (OPF) problem is nonconvex and generally hard to solve. We provide a sufficient condition under which the OPF problem is equivalent to a convex problem and therefore is efficiently solvable. Specifically, we prove that the dual of OPF is a semidefinite program and our sufficient condition guarantees that the duality gap is zero and a globally optimal solution of OPF is recoverable from a dual optimal solution. This sufficient condition is satisfied by standard IEEE benchmark systems with 14, 30, 57, 118 and 300 buses after small resistance (10-5 per unit) is added to every transformer that originally assumes zero resistance. We justify why the condition might hold widely in practice from algebraic and geometric perspectives. The main underlying reason is that physical quantities such as resistance, capacitance and inductance, are all positive.