Having sold 70 per cent of its oil assets in two years, the Spanish energy group is pursuing a renewable future