In a method of machining the spherical surfaces of a piston for a swash plate type compressor for machining the spherical surfaces of the swash-plate-passing-slot of the piston through which a swash plate passes, wherein the swash plate rotates about a rotating axis and the peripheral edge surfaces of the swash plate carry out a reciprocating motion in a direction substantially along the rotating axis and the motion of the swash plate is converted into a reciprocating motion in a cylinder bore by the piston through spherical shoes. The method comprises the step of machining the spherical recesses of both the end surfaces of the swash-plate-passing-slot for accommodating and retaining the spherical portions of the spherical shoes by moving the center axis of a tool element having a spherical cutter from the rotational center axis of a machine tool while rotating the tool element.