Large deviations for random matrices via spherical integrals