Let A=A(g,l,n) denote the moduli scheme over Z [1/n] of p.p. g-dimensional abelian varieties with a level n structure; its generic fibre can be described as a Shimura variety. We study its 'Shimura subvarieties'. If x is an element of A is an ordinary moduli point in characteristic p, then we formulate a local 'linearity property' in terms of the Serre-Tate group structure on the formal deformation space (= formal completion of A at x). We prove that an irreducible algebraic subvariety of A is a 'Shimura subvariety' if, locally at an ordinary point x, it is 'formally linear'. We show that there is a close connection to a differential-geometrical linearity property in characteristic 0. We apply our results to the study of Oort's conjecture on subvarieties Z hooked right arrow A With a dense collection of CM-points. We give a reformulation of this conjecture, and we prove it in a special case.