Advances in spatial transcriptomics technologies has enabled gene expression profiling of tissues while retaining the spatial context. To effectively exploit the data, spatially informed analysis tools are required. Here, we present DeepST, a versatile graph self-supervised contrastive learning framework that incorporates spatial location information and gene expression profiles to accomplish three key tasks, spatial clustering, spatial transcriptomics (ST) data integration, and single-cell RNA-seq (scRNA-seq) data transfer onto ST. DeepST combines graph neural networks (GNNs) with self-supervised contrastive learning to learn spot representations in the ST data, and an auto-encoder to extract informative features in the scRNA-seq data. Spatial self-supervised contrastive learning enables the learned spatial spot representation to be more informative and discriminative by minimizing the embedding distance between spatially adjacent spots and vice versa. With DeepST, we found biologically consistent clusters with higher accuracy than competing methods. We next demonstrated DeepST’s ability to jointly analyze multiple tissue slices in both vertical and horizontal integration while correcting for batch effects. Lastly, we used DeepST to deconvolute cell types present in ST with scRNA-seq data, showing better performance than cell2location. We also demonstrated DeepST’s accurate cell type mapping to recover immune cell distribution in the different regions of breast tumor tissue. DeepST is a user-friendly and computationally efficient tool for capturing and dissecting the heterogeneity within ST data, enabling biologists to gain insights into the cellular states within tissues.