A new generation of spatial transcriptomics platforms measure single cell gene expression while retaining cell’s locations within tissues. Accurate cell typing - using cell’s gene expression profiles to assign them to a cluster or cell type – is fundamental to analyzing this data. We introduce the Insitutype cell typing algorithm, designed to maximal statistical power in spatial transcriptomics data. Insitutype can perform unsupervised clustering via an EM algorithm, supervised cell classification via a Bayes classifier, or semi-supervised detection of unknown clusters alongside reference cell types. Cells’ images and spatial contexts can be harnessed for further information.