An efficient Monte Carlo algorithm for overcoming broken ergodicity in the simulation of spin systems