The problem of optimal siting and sizing of distribution static compensators (STATCOMs) is addressed in this research from the point of view of exact mathematical optimization. The exact mixed-integer nonlinear programming model (MINLP) is decoupled into two convex optimization sub-problems, named the location problem and the sizing problem. The location problem is addressed by relaxing the exact MINLP model, assuming that all the voltages are equal to 1∠0∘, which allows obtaining a mixed-integer quadratic programming model as a function of the active and reactive power flows. The solution of this model provides the best set of nodes to locate all the STATCOMs. When all the nodes are selected, it solves the optimal reactive power problem through a second-order cone programming relaxation of the exact optimal power flow problem; the solution of the SOCP model provides the optimal sizes of the STATCOMs. Finally, it refines the exact objective function value due to the intrinsic non-convexities associated with the costs of the STATCOMs that were relaxed through the application of Taylor’s series expansion in the location and sizing stages. The numerical results in the IEEE 33- and 69-bus systems demonstrate the effectiveness and robustness of the proposed optimization problem when compared with large-scale MINLP solvers in GAMS and the discrete-continuous version of the vortex search algorithm (DCVSA) recently reported in the current literature. With respect to the benchmark cases of the test feeders, the proposed approach reaches the best reductions with 14.17% and 15.79% in the annual operative costs, which improves the solutions of the DCVSA, which are 13.71% and 15.30%, respectively.