Spanish Socialists' candidate elected speaker with support of Catalan groups