Computationally integrating spatial transcriptomics (ST) and single-cell transcriptomics (SC) greatly benefits biomedical research such as cellular organization, embryogenesis and tumorigenesis, and could further facilitate therapeutic developments. We proposed a transfer learning model, STEM, to learn spatially-aware embeddings from gene expression for both ST and SC data. The embeddings satisfy both the preservation of spatial information and the elimination of the domain gap between SC and ST data. We used these embeddings to infer the SC-ST mapping and the pseudo SC spatial adjacency, and adopted the attribution function to indicate which genes dominate the spatial information. We designed a comprehensive evaluation pipeline and conducted two simulation experiments, and STEM achieved the best performance compared with previous methods. We applied STEM to human squamous cell carcinoma data and successfully uncovered the spatial localization of rare cell types. STEM is a powerful tool for building single-cell level spatial landscapes and could provide mechanistic insights of heterogeneity and microenvironments in tissues.