The typical optical pulse from a gain-switched semiconductor laser diode (LD) usually consists of a first-spike (FS) component and a quasi-steady-state (QSS) lasing component. For the stability and accuracy in some specific applications of sensing and detection, it is necessary to achieve a smooth QSS component without the FS component (regarded as spike noise). This Letter reports a technique to smooth the optical pulse shape from gain-switched LDs via stepped electric pulse, which can eliminate or suppress the FS component effectively, without any postprocessing. Rate-equation calculations well reproduced the major features of the experimental results and revealed that the pre-pump of the stepped electrical pulse plays a crucial role by adjusting the accumulated carrier density to be close to threshold before lasing in the LD, which suppresses the FS generation during the main pump injects and allows LD transit more rapidly into the QSS mode. The stepped electrical pulse pump provides a feasible and convenient method to smooth the optical pulse shape of gain-switched semiconductor LDs for various applications.