A motor drive system providing power factor compensation and comprising: a switching rectifier system receiving a source of AC power to selectively couple the AC power with an intermediate DC link to provide a DC link current or voltage; and including an input filter, the filter including input capacitors; an inverter coupled to the DC link to receive the DC link current or voltage and to synthesize an AC output current or voltage to a motor; a controller coupled to the switching rectifier system and the inverter and executing a stored program (86, 92) to: receive an operating command describing a desired operating point of the motor; monitor a current and a voltage from the source of AC power at an input to the motor drive system; determine a reactive power of the motor drive at the desired operating point from the monitored current and voltage; determine a motor flux reference (F ref) tending to correct the reactive power to the desired value, wherein the motor flux reference (F ref) is adjusted in a first direction when the reactive power indicates a lagging power factor and in a second direction when the reactive power indicates a leading power factor; and generate first and second sets of control signals to the rectifier and inverter in order to generate an AC output current and voltage to the motor providing the desired operating point of the motor and also generate modulation signals (α and θ) for the rectifier and the inverter based on the motor flux reference, in order to create a desired compensating current in the DC link and thereby correct the power factor error. a switching rectifier system receiving a source of AC power to selectively couple the AC power with an intermediate DC link to provide a DC link current or voltage; and including an input filter, the filter including input capacitors; an inverter coupled to the DC link to receive the DC link current or voltage and to synthesize an AC output current or voltage to a motor; a controller coupled to the switching rectifier system and the inverter and executing a stored program (86, 92) to: receive an operating command describing a desired operating point of the motor; monitor a current and a voltage from the source of AC power at an input to the motor drive system; determine a reactive power of the motor drive at the desired operating point from the monitored current and voltage; determine a motor flux reference (F ref) tending to correct the reactive power to the desired value, wherein the motor flux reference (F ref) is adjusted in a first direction when the reactive power indicates a lagging power factor and in a second direction when the reactive power indicates a leading power factor; and generate first and second sets of control signals to the rectifier and inverter in order to generate an AC output current and voltage to the motor providing the desired operating point of the motor and also generate modulation signals (α and θ) for the rectifier and the inverter based on the motor flux reference, in order to create a desired compensating current in the DC link and thereby correct the power factor error. receive an operating command describing a desired operating point of the motor; monitor a current and a voltage from the source of AC power at an input to the motor drive system; determine a reactive power of the motor drive at the desired operating point from the monitored current and voltage; determine a motor flux reference (F ref) tending to correct the reactive power to the desired value, wherein the motor flux reference (F ref) is adjusted in a first direction when the reactive power indicates a lagging power factor and in a second direction when the reactive power indicates a leading power factor; and generate first and second sets of control signals to the rectifier and inverter in order to generate an AC output current and voltage to the motor providing the desired operating point of the motor and also generate modulation signals (α and θ) for the rectifier and the inverter based on the motor flux reference, in order to create a desired compensating current in the DC link and thereby correct the power factor error.