US President Donald Trump welcomed the election setback for Spanish Prime Minister Pedro Sánchez, calling it "great news".