When exchanging a tool, a tool of a spindle is stored in an empty pocket of a tool magazine, and thereafter, upward movement of the spindle and rotation of the tool magazine are simultaneously executed. At this time, synchronous control is performed in order to prevent a collision between the spindle and the tool. When installing a next tool in the spindle, both downward movement of the spindle and rotation of the tool magazine are executed while synchronously controlling. The tool exchange time can be shortened with simultaneously executing the movements of the spindle and the tool magazine.