An object of the present invention is to provide a construction of a motor with a built-in sensor, in which the total length of the motor is not increased, and can be made approximately equal to the total length of the conventional motor which has no built-in sensor. To achieve this object, in a motor 1 comprising a rotor 3 having rotor cores 6a and 6b and a stator 2 in which windings 5 are wound on a stator core 4 to form a rotational magnetic field, a substantially cylindrical recess 21 with a diameter smaller than the outside diameter of the rotor 3 is formed at the end face portion of the rotor core 6a, 6b, and in a space 22 which communicates with the recess 21, including the recess 21, and reaches the end face of the windings 5 of the stator 2, a part of a motor frame 11 to which a bearing 9 for rotatably supporting a rotor shaft 7 while passing through it is fitted and a sensor 23, on the outside of the bearing 9, for detecting the position or speed of the motor 1 are disposed.