Spatial transcriptomics (STs) simultaneously obtains the location and amount of gene expression within a tissue section. However, current methods like FindMarkers calculated the differentially expressed genes (DEGs) based on the classical statistics, which should abolish the spatial information. A new method named spatial analysis of spatial transcriptomics (saSpatial) was developed for both the location and the amount of gene expression. Then saSpatial was applied to detect DEGs in both inter- and intra-cross sections. DEGs detected by saSpatial were compared with those detected by FindMarkers. Spatial analysis of spatial transcriptomics was founded on the basis of spatial statistics. It was able to detect DEGs in different regions in the normal brain section. As for the brain with ischemic stroke, saSpatial revealed the DEGs for the ischemic core and penumbra. In addition, saSpatial characterized the genetic heterogeneity in the normal and ischemic cortex. Compared to FindMarkers, a larger number of valuable DEGs were found by saSpatial. Spatial analysis of spatial transcriptomics was able to effectively detect DEGs in STs data. It was a simple and valuable tool that could help potential researchers to find more valuable genes in the future research.