Effective methods for the design of high-performance electrical machines must use optimization techniques and precise and fast physical models. Convergence, precision and speed of execution are important issues, in addition to the ability to explore the entire domain of solutions. The finite element method (FEM) presents a high accuracy in the results but with high computational costs. Analytical models, on the other hand, solve the problem quickly but compromise the accuracy of the results. This work shows a comparison between an optimization made with an analytical electromagnetic model and a direct optimization with finite element field calculation for the optimal design of a Halbach array permanent magnet synchronous motor (PMSM). In the case of the analytical model, it is necessary to use an iterative method of correcting the model to obtain a valid solution. This method is known as Space Mapping (SM) and the analytical model can be improved with a reduced number of iterations with the FEM. The results show a rapid convergence towards an optimal solution for the SM, with more than 78% reduction in computational cost compared to a Direct FEM optimization. Both solutions have only a difference of 3% on the power density, which indicates that FEM does not improve the results obtained by SM. This represents a great advantage that allows for the consideration of a large amount of designs to analyze the domain of solutions in more detail. This study also shows that SM is a powerful method to optimize the power density or torque density of electrical machines.