Cell states are modulated by intrinsic driving forces such as gene expression noise and extrinsic signals from the tissue microenvironment. The distinction between intrinsic and extrinsic cell state determinants is essential for understanding the regulation of cell fate in tissues during development, homeostasis and disease. The rapidly growing availability of single-cell resolution spatial transcriptomics makes it possible to meet this challenge. However, available computational methods to infer topological tissue domains, spatially variable genes, or ligand-receptor interactions are limited in their capacity to capture cell state changes driven by crosstalk between individual cell types within the same niche. We present NiCo, a computational framework for integrating single-cell resolution spatial transcriptomics with matched single-cell RNA-sequencing reference data to infer the influence of the spatial niche on the cell state. By applying NiCo to mouse embryogenesis, adult small intestine and liver data, we demonstrate the ability to predict novel niche interactions that govern cell state variation underlying tissue development and homeostasis. In particular, NiCo predicts a feedback mechanism between Kupffer cells and neighboring stellate cells dampening stellate cell activation in the normal liver. NiCo provides a powerful tool to elucidate tissue architecture and to identify drivers of cellular states in local niches.