Spanish Prime Minister Pedro Sánchez has delivered a strong rebuttal to US President Donald Trump's threat to end trade with Spain by declaring his opposition to war and what he called the "breakdown of international law".

In a 10-minute televised address Sánchez reflected on the wars in Ukraine and Gaza as well as the Iraq War more than 20 years ago and said "the government's position can be summed up in four words: No to war".

Trump threatened to impose a full trade embargo on Spain in response to Madrid's refusal to allow the US to use the jointly run bases at Morón and Rotafor for strikes on Iran.

"Spain has been terrible," Trump said during a meeting with German Chancellor Friedrich Merz on Tuesday.

"We're going to cut off all trade with Spain. We don't want anything to do with Spain," he added.