Spain’s prime minister says Europe’s energy system is a ‘market that doesn’t function’