A motor control apparatus comprising: a main circuit including a converter configured to convert AC power supply into DC power supply, a smoothing capacitor connected in parallel with the DC power supply, and an inverter configured to convert the DC power supply into AC power supply to drive a motor; a voltage detector configured to detect DC voltage of the main circuit; and a controller (6; 6A; 6B; 6C) including a position controller configured to generate a speed command (Vr) on the basis of a positional command (Pr) and a motor position (Pfb), and a speed controller configured to generate a torque command (Tr) on the basis of the speed command (Vr) and a motor speed (Vfb), the controller being configured to control the inverter on the basis of the torque command (Tr), characterized in that the controller (6; 6A; 6B; 6C) includes: a torque limiter (17; 17C) configured to perform first torque limitation which limits a commanded torque based on the torque command (Tr) to a first torque or less a speed limiter configured to limit a commanded speed based on the speed command (Vr) to a first speed or less to prevent an occurrence of an overspeed alarm of the motor when the speed command (Vr) corresponding to increased positional deviation with the first torque limitation performed is outputted to the speed controller, and a function enabling and disabling processor configured to enable a torque limiting function performed by the torque limiter (17; 17C) in a case where the voltage detector detects that the DC voltage falls below a predetermined voltage, and configured to disable the torque limiting function performed by the torque limiter (17; 17C) and enable a speed limiting function performed by the speed limiter in a case where the voltage detector detects that the DC voltage exceeds the predetermined voltage. a main circuit including a converter configured to convert AC power supply into DC power supply, a smoothing capacitor connected in parallel with the DC power supply, and an inverter configured to convert the DC power supply into AC power supply to drive a motor; a voltage detector configured to detect DC voltage of the main circuit; and a controller (6; 6A; 6B; 6C) including a position controller configured to generate a speed command (Vr) on the basis of a positional command (Pr) and a motor position (Pfb), and a speed controller configured to generate a torque command (Tr) on the basis of the speed command (Vr) and a motor speed (Vfb), the controller being configured to control the inverter on the basis of the torque command (Tr), a torque limiter (17; 17C) configured to perform first torque limitation which limits a commanded torque based on the torque command (Tr) to a first torque or less a speed limiter configured to limit a commanded speed based on the speed command (Vr) to a first speed or less to prevent an occurrence of an overspeed alarm of the motor when the speed command (Vr) corresponding to increased positional deviation with the first torque limitation performed is outputted to the speed controller, and a function enabling and disabling processor configured to enable a torque limiting function performed by the torque limiter (17; 17C) in a case where the voltage detector detects that the DC voltage falls below a predetermined voltage, and configured to disable the torque limiting function performed by the torque limiter (17; 17C) and enable a speed limiting function performed by the speed limiter in a case where the voltage detector detects that the DC voltage exceeds the predetermined voltage.