Subject of study. For a grating-based imaging spectrometer, a method of using an off-axis lens to correct the smile and keystone is proposed and verified by simulation. Method. In the set coordinate system, the ratios of direction cosines of the refractive rays along the y-axis and z-axis are studied using the spatial ray tracing method. On this basis, the smile characteristics of a single refraction sphere and an off-axis lens have been analyzed. In order to verify the theory, a visible spectral imaging system without an off-axis lens and one with an off-axis lens have been optimized, respectively. Main results. The criterion of the smile sign has been given and discussed. For the spectral imaging system without an off-axis lens, good image quality and high spectral resolution have been achieved, which is less than 1 nm. The modulation transfer functions at the wavelengths of 400, 600, and 800 nm are greater than 0.5 at the Nyquist frequency. However, the maximums of the smile and keystone are greater than 0.07 and 0.06 mm, respectively, which are several times the unit size. For the spectral imaging system with an off-axis lens, the image quality is basically the same as the previous one. The obvious differences between the two systems are the smile and keystone. For the latter, the maximums of smile and keystone at all working wavelengths in all fields are close to 6.24 and 6.40 µm, which are less than half of the unit size. Practical significance. The smile and keystone caused by a plane grating can be corrected by an off-axis lens in a plane-grating-based imaging spectrometer, which provides a universal method for the design of a spectral imaging system.