This paper proposes an implementation of distribution static compensator (DSTATCOM) for the three-phase distribution system. The functions of DSTATCOM are harmonics elimination, compensation of reactive power, and load balancing in power factor correction and voltage regulation modes. A variable forgetting factor recursive least square (VFFRLS)-based control algorithm is proposed for effective operation of DSTATCOM to estimate weighted values of active and reactive power components of load current. The proposed control algorithm is fast in convergence and has quick response. A prototype of DSTATCOM is developed in the laboratory using a digital signal processor (dSPACE 1104) and voltage-source converter and tested for various operating conditions under nonlinear load. The performance of DSTATCOM is found satisfactory in mitigating various power-quality problems with the VFFRLS-based control algorithm.