Spain’s embattled Socialists elect new leader