Donald Trump hit out at European allies over defense spending and the war in Iran as Washington moves to scale back its long-term NATO commitments.