Let M(n) be the algebra of n x n matrices over an algebraically closed field F of characteristic zero. For A is-an-element-of M(n), denote by S(A) the collection of all matrices in M(n) that are similar to A. In this paper we characterize those invertible linear operators phi on M(n) that satisfy phi(S) subset-or-equal-to S or phi(SBAR), subset-or-equal-to SBAR, where S = S(A1) or...or S(A(k)) for some given A1,...,A(k) is-an-element-of M(n) and S denotes the (Zariski) closure of S. Our theorem covers a result of Howard on linear operators mapping the set of matrices annihilated by a given polynomial into itself, and extends a result of Chan and Lim on linear operators commuting with the function f(x) = x(k) for a given positive integer k greater-than-or-equal-to 2. The possibility of weakening the invertibility assumption in our theorem is considered, a partial answer to a conjecture of Howard is given, and some extensions of our result to arbitrary fields are discussed.