The immune system can promote the elimination of tumours, but often immune responses are modulated or suppressed by the tumour microenvironment. In this joint Focus from Nature Reviews Cancer and Nature Reviews Immunology, leading researchers describe our current understanding of the complex interactions that occur between the immune system and tumour cells, and discuss how the power of the immune system can be harnessed by anticancer immunotherapies.