In this paper, the crystal geometry, electronic structure, lattice vibration, Infrared and Raman spectra of ternary layered borides M3AlB2 (M = Ti, Zr, Hf, Ta) are studied by using first principles calculation method based on the density functional theory. The electronic structure of M3AlB2 indicates that they are all electrical conductors, and the d orbitals of Ti, Zr, Hf, and Ta occupy most of the bottom of the conduction band and most of the top of the valence band. Al and B have lower contributions near their Fermi level. The lightweight and stronger chemical bonds of atom B are important factors that correspond to higher levels of peak positions in the Infrared and Raman spectra. However, the vibration frequencies, phonon density of states, and peak positions of Infrared and Raman spectra are significantly lower because of heavier masses and weaker chemical bonds for M and Al atoms. And, there are 6 Infrared active modes A2u and E1u, and 7 Raman active modes, namely A1g, E2g, and E1g corresponding to different vibration frequencies in M3AlB2. Furthermore, the Infrared and Raman spectra of M3AlB2 were obtained respectively, which intuitively provided a reliable Infrared and Raman vibration position and intensity theoretical basis for the experimental study.