A mass spectrometer having a function of performing a tuning process for optimizing a control parameter of each section of the mass spectrometer based on a result of a mass spectrometry performed on a predetermined component in a sample, the mass spectrometer comprising: a) a parameter setting section for changing a value of a control parameter to be adjusted in predetermined steps over a predetermined range, the parameter setting section being switchable between a coarse control mode for changing the value of the control parameter in steps of a first size over a first predetermined range and a fine control mode for changing the value of the control parameter in steps of a second size smaller than the first size over a second predetermined range narrower than the first predetermined range; b) a result obtaining section for obtaining ion-intensity information for an ion originating from the predetermined component every time the value of the control parameter is changed by the parameter setting section; and c) a parameter optimizing section for performing a measurement in the coarse control mode using the parameter setting section during a period of time in which the predetermined component in the sample is introduced, for calculating, as an amount of change in the ion intensity for a predetermined amount of change in the value of the control parameter, a difference between a highest ion intensity among a plurality of ion intensities obtained by the result obtaining section in the coarse control mode and another ion intensity obtained at a value of the control parameter next to the value of the control parameter giving the highest ion intensity, characterized in that: the parameter optimizing section is configured for comparing the difference in the ion intensity with a threshold to determine whether an optimal value of the control parameter should be determined from the ion-intensity information obtained in the coarse control mode or a measurement in the fine control mode should subsequently be performed to determine an optimal value of the control parameter from the ion-intensity information obtained by the result obtaining section in the fine control mode. a) a parameter setting section for changing a value of a control parameter to be adjusted in predetermined steps over a predetermined range, the parameter setting section being switchable between a coarse control mode for changing the value of the control parameter in steps of a first size over a first predetermined range and a fine control mode for changing the value of the control parameter in steps of a second size smaller than the first size over a second predetermined range narrower than the first predetermined range; b) a result obtaining section for obtaining ion-intensity information for an ion originating from the predetermined component every time the value of the control parameter is changed by the parameter setting section; and c) a parameter optimizing section for performing a measurement in the coarse control mode using the parameter setting section during a period of time in which the predetermined component in the sample is introduced, for calculating, as an amount of change in the ion intensity for a predetermined amount of change in the value of the control parameter, a difference between a highest ion intensity among a plurality of ion intensities obtained by the result obtaining section in the coarse control mode and another ion intensity obtained at a value of the control parameter next to the value of the control parameter giving the highest ion intensity, the parameter optimizing section is configured for comparing the difference in the ion intensity with a threshold to determine whether an optimal value of the control parameter should be determined from the ion-intensity information obtained in the coarse control mode or a measurement in the fine control mode should subsequently be performed to determine an optimal value of the control parameter from the ion-intensity information obtained by the result obtaining section in the fine control mode.