Because of its relatively small magnitude compared with the carrier flow field variations, an acoustic signal is not easily tracked without distortion and degradation to the phase and amplitude information contained therein. The spurious dispersion and dissipation effects introduced by most numerical methods for computational fluid dynamics are detrimental to an accurate calculation of the acoustic signal. To rectify such deficiency in current codes, a least-squares spectral element method was developed to solve the linearized acoustic field equations derived from the full Navier--Stokes equations. The method solves the first-order partial-differential equations and minimizes the integral of the squares of the residual over the domain of interest. Spatial derivatives are approximated by Legendre polynomials, and temporal discretization is performed by dual-time stepping. The resultant algebraic equations are solved by a Jacobi preconditioned conjugate gradient method. Numerical examples were presented for a Gaussian pulse in a uniform flow of Mach 0.5 above an infinite plate. The computed acoustic pressures on the wall at different time instances were compared against the exact analytical values, and the comparison showed very good agreement. It indicates that the proposed method is indeed suitable for computing the sound generation and propagation in an unsteady flow regime.