The problem associated with economic dispatch of battery energy storage systems (BESSs) in alternating current (AC) distribution networks is addressed in this paper through convex optimization. The exact nonlinear programming model that represents the economic dispatch problem is transformed into a second-order cone programming (SOCP) model, thereby guaranteeing the global optimal solution-finding due to the conic (i.e., convex) structure of the solution space. The proposed economic dispatch model of the BESS considers the possibility of injecting/absorbing active and reactive power, in turn, enabling the dynamical apparent power compensation in the distribution network. A basic control design based on passivity-based control theory is introduced in order to show the possibility of independently controlling both powers (i.e., active and reactive). The computational validation of the proposed SOCP model in a medium-voltage test feeder composed of 33 nodes demonstrates the efficiency of convex optimization for solving nonlinear programming models via conic approximations. All numerical validations have been carried out in the general algebraic modeling system.