Optimal control problems in measure spaces governed by semilinear elliptic equations are considered. First order optimality conditions are derived and structural properties of their solutions, in particular sparsity, are discussed. Necessary and sufficient second order optimality conditions are obtained as well. On the basis of the sufficient conditions, stability of the solutions is analyzed. Highly nonlinear terms can be incorporated by utilizing an L() regularity result for solutions of the first order necessary optimality conditions.