Microlocal Analysis, Sharp Spectral Asymptotics and Applications I