US President Donald Trump has threatened to halt all trade with Spain, after the country barred the US from using its military bases as part of its operation in Iran.