Although it is known that the spectral element method (SEM) has both high accuracy and a lower computational cost when compared with finite-element or finite-difference methods, the SEM is not widely utilized in the modeling of boundary value problems in electromagnetics. This paper provides a 2-D formulation of the well-known perfectly-matched-layer approach in the context of the SEM for the frequency-domain electromagnetic problems in which dielectric scatterers are involved. The formulation is then utilized to numerically study photonic nanojets after the demonstration of SEM accuracy in an electromagnetic scattering problem. Interesting cases where unusual results are obtained from scattering dielectric cylinders are reported and discussed in this paper. On the other hand, a finite-difference time-domain method that is widely deployed for investigating photonic nanojets is found to fail in successfully capturing such resonance cases. Sharp resonances are characteristic of high-Q cavities and numerical methods with high accuracy, e.g., the SEM can provide superior performance while exploring such resonators.