Spatial finite-difference (FD) coefficients are usually determined by the Taylor-series expansion (TE) or optimization methods. The former can provide high accuracy on a smaller wavenumber or frequency zone, and the latter can give moderate accuracy on a larger zone. Present optimization methods applied to calculate FD coefficients are generally gradient-like or global optimization-like algorithms, and thus iterations are involved. They are more computationally expensive, and sometimes the global solution may not be found. I examined second-order spatial derivatives and computed the optimized spatial FD coefficients over the given wavenumber range using the least-squares (LS) method. The results indicated that the FD accuracy increased with increasing operator length and decreasing wavenumber range. Therefore, for the given error and operator length, globally optimal spatial FD coefficients can be easily obtained. Some optimal FD coefficients were given. I developed schemes to obtain optimized LS-based spatial FD coefficients by minimizing the relative error of space-domain dispersion relation for second-order derivatives and time-space-domain dispersion relation for the acoustic wave equation. I discovered that minimizing the relative error of the space-domain dispersion relation provides less phase velocity error for small wavenumbers, compared to minimizing the absolute error. I also found that minimizing the relative error of the time-space-domain dispersion relation can reduce relative errors of phase velocity. Accuracy analysis demonstrated the correctness and advantage of schemes. I gave three examples of 2D acoustic FD modeling for a homogeneous, a large velocity-contrast, and a heterogeneous model, respectively. LS-based spatial FD operators have variable lengths for different velocities. Modeling examples demonstrated that the proposed LS-based FD scheme can maintain the same modeling precision while using a shorter spatial FD operator length, thus reducing the computation cost relative to conventional TE-based FD schemes, particularly for the higher order.