This paper studies the magnet shape optimization of a five-phase surface-mounted permanent magnet (PM) machine to improve its torque performance. First, a sinusoidal PM with third and fifth harmonics (sine + third + fifth PM) is presented to enhance the torque. An equivalent PM method is then proposed to avoid the complicated interface conditions between PM and the air gap, making the derivation of torques with magnet shapes using 2-D analytical models possible. Besides, the influence of PM edge thickness on torque improvement is considered. Moreover, under the condition that the copper losses of machines with different magnet shapes are kept unchanged, optimal harmonics of sinusoidal PM with third harmonic (sine + third PM) and sine + third + fifth PM are analytically derived. Finite element (FE) analysis is performed to validate the equivalent PM method and analytical results. Finally, machines with sine + third PM, sine + third + fifth PM and conventional (without shaping) PM are comparatively studied using nonlinear FE analysis and the experimental results of machine with sine + third + fifth PM are presented, verifying the effectiveness of the analytical optimization of magnet shape.