Due to the proliferation of harmonic producing-loads, harmonic resonance has become a major hurdle for performing power factor compensation in commercial power systems, such as office towers and shopping complexes. This paper presents an intelligent power factor compensation controller that can perform power factor correction without exciting harmonic resonance under varying demand conditions. Practical and robust control algorithms are proposed for the purpose of easy implementation in a micro-controller. In addition, the controller relies on common low cost sensing devices and does not require additional measurements. As a result, the proposed controller can be constructed as a retrofitting device to replace existing power factor correction controllers with little effort. Analysis of representative case studies is conducted to illustrate how the proposed controller performs.