Socialists win surprise outright majority