An electric machine control method comprising: selecting a control mode from a current vector control and a voltage phase control in accordance with a predetermined condition, the current vector control using a first voltage command value (v* di; v* qi) calculated so that an output current of an electric machine follows a current command value (id ∗, iq ∗) generated based on a torque command value (T ∗) to the electric machine, the voltage phase control using a second voltage command value (v* dv; v* qv) calculated based on a voltage norm command value (Va ∗) and a voltage phase (α ∗), the voltage phase (α ∗) being based on the power-supply voltage and the torque command value (T ∗); setting, as a voltage command value (vd ∗, vq ∗), either one of the first voltage command value and the second voltage command value in accordance with the control mode thus selected; characterized by calculating a modulation rate (m) based on the power-supply voltage and the voltage command value (vd ∗, vq ∗); the voltage norm command value (Va*) being based on a power-supply voltage (V dc) and a predetermined modulation rate command value (m*); calculating a compensation gain (Kcomp) in accordance with the modulation rate (m), the compensation gain (Kcomp) being used to linearize a relationship between a magnitude of the voltage command value (vd ∗, vq ∗) and a magnitude of a fundamental wave component of an output voltage to the electric machine; calculating a compensated voltage command value (vdcomp ∗, vqcomp ∗) based on the voltage command value (vd ∗, vq ∗) and the compensation gain (Kcomp); controlling the output voltage to the electric machine based on the compensated voltage command value (vdcomp ∗, vqcomp ∗); and limiting the compensation gain (Kcomp) to be equal to or less than a predetermined upper limit, wherein the limiting of the compensation gain (Kcomp) is executed: when the control mode is switched from the current vector control to the voltage phase control; by setting, to the modulation rate command value (m ∗), an upper limit of the modulation rate (m) calculated based on the power-supply voltage and the voltage command value (vd ∗, vq ∗); or by setting the upper limit of the compensation gain (Kcomp) to a predetermined limiting value (Km upper) corresponding to the modulation rate command value (m ∗). selecting a control mode from a current vector control and a voltage phase control in accordance with a predetermined condition, the current vector control using a first voltage command value (v* di; v* qi) calculated so that an output current of an electric machine follows a current command value (id ∗, iq ∗) generated based on a torque command value (T ∗) to the electric machine, the voltage phase control using a second voltage command value (v* dv; v* qv) calculated based on a voltage norm command value (Va ∗) and a voltage phase (α ∗), the voltage phase (α ∗) being based on the power-supply voltage and the torque command value (T ∗); setting, as a voltage command value (vd ∗, vq ∗), either one of the first voltage command value and the second voltage command value in accordance with the control mode thus selected; characterized by calculating a modulation rate (m) based on the power-supply voltage and the voltage command value (vd ∗, vq ∗); the voltage norm command value (Va*) being based on a power-supply voltage (V dc) and a predetermined modulation rate command value (m*); calculating a compensation gain (Kcomp) in accordance with the modulation rate (m), the compensation gain (Kcomp) being used to linearize a relationship between a magnitude of the voltage command value (vd ∗, vq ∗) and a magnitude of a fundamental wave component of an output voltage to the electric machine; calculating a compensated voltage command value (vdcomp ∗, vqcomp ∗) based on the voltage command value (vd ∗, vq ∗) and the compensation gain (Kcomp); controlling the output voltage to the electric machine based on the compensated voltage command value (vdcomp ∗, vqcomp ∗); and limiting the compensation gain (Kcomp) to be equal to or less than a predetermined upper limit, wherein the limiting of the compensation gain (Kcomp) is executed: when the control mode is switched from the current vector control to the voltage phase control; by setting, to the modulation rate command value (m ∗), an upper limit of the modulation rate (m) calculated based on the power-supply voltage and the voltage command value (vd ∗, vq ∗); or by setting the upper limit of the compensation gain (Kcomp) to a predetermined limiting value (Km upper) corresponding to the modulation rate command value (m ∗). when the control mode is switched from the current vector control to the voltage phase control; by setting, to the modulation rate command value (m ∗), an upper limit of the modulation rate (m) calculated based on the power-supply voltage and the voltage command value (vd ∗, vq ∗); or by setting the upper limit of the compensation gain (Kcomp) to a predetermined limiting value (Km upper) corresponding to the modulation rate command value (m ∗).