Opposition claims win in legislative elections over the ruling socialists for the first time in 17 years.