Felipe VI and his wife Letizia, who had been forced to postpone their planned visit last year because of the political crisis in Spain, will now visit Britain on June 6th-8th, the palace said in a statement.
This means Trump's state visit will be "later in the year," Prime Minister Theresa May's spokesman said.
British media have reported that October is the most likely date for the US leader, whose trip is expected to be accompanied by massive protests.
The police earlier said they were preparing for Trump to arrive in June but reports citing senior government sources later said this had been delayed.
May extended the invitation for a state visit, a high honour that involves a banquet with Queen Elizabeth II, when she met Trump at the White House in late January.
It was part of a charm offensive intended to strengthen bilateral ties as Britain prepares to leave the European Union.
But coming at the same time as Trump announced his ban on refugees and travellers from seven mainly Muslim countries, it sparked public outrage in Britain.
More than 1.8 million signed a petition asking for the visit to be cancelled, prompting a debate in parliament where several lawmakers condemned the proposal.
The Speaker of the House of Commons, John Bercow, has also said he believes Trump should not be allowed the honour of giving a speech to parliament.