In a displacement sensor (10), a shaft (24) of a movable member
(14) comprises a tubular part (26) having an opening (26c)
at one end. A rod-form permanent is inserted into the tubular part (26)
through the opening (26c) . A spacer (32) is fitted over a
narrow portion of the rod-form magnet (28). The thickest portion of the
magnet (28) and the spacer (32) contact the side wall of the tubular
part (26) tightly, so that the magnet (28) is disposed coaxially
with the tubular part (26). A stopper (26d) is formed on the
opening (26c) of the tubular part (26), so that the magnet
(28) does not move axially. Therefore, the magnet (28) is mounted
in a prescribed position in a movable member (14) with a high degree of accuracy.