We present a method that minimizes the cogging torque in rotor surface mounted permanent-magnet motors. The key idea is to set the distribution of the air-gap flux density by segmenting the magnet pole into several elementary magnet blocks. By choosing either the appropriate elementary magnet block span or the relative position of the magnet blocks, the cogging torque may be significantly reduced. Our analytical approach uses Fourier series to predict the cogging torque harmonics, and finite-element computations. Our numerical results confirm the analytical conclusions.