The UK's "coalition" with Spain will survive the change of government in Madrid, a UK cabinet minister has said.
Tony Blair has had worked closely with Spain's outgoing prime minister
Leader of the Commons Peter Hain congratulated the Socialist Party for its win, announced on Sunday evening.
He said Tony Blair will work as closely with new counterpart Jose Rodriguez Zapatero as he had with outgoing prime minister Jose Maria Aznar.
Mr Hain told the BBC: "The coalition between Spain and Britain has been a driving force for reform in Europe".
Spain was a key ally of Britain and the US in the Iraq conflict last year.
Mr Aznar sided with US President George Bush and British Prime Minister Tony Blair over the US-led invasion despite strong opposition among the Spanish public.
The Socialist Party had been opposed to Spain's involvement.
But Mr Hain told BBC Radio 4's Westminster Hour the new Spanish government's opposition to the Iraq conflict
should not be a barrier to co-operation.
"The Prime Minister Tony Blair will want to work with him as the leader of Spain just as closely as he has with Jose Maria Aznar," the cabinet minister told the programme.
Mr Zapatero's socialist party claimed a surprise win on Sunday as authorities revealed one of the men arrested over last Thursday's rail bombings, which killed 200, had ties to al-Qaeda.
Some Spaniards who turned out to vote expressed anger that Mr Aznar's ruling party had blamed the attacks on the Basque separatist group Eta, while playing down al-Qaeda involvement.
Mr Hain said Germany under Chancellor Gerhard Schroeder had also been anti-war but the two countries had been able to cast aside their differences to work together.
"You have seen the close friendship between Tony Blair and Gerhard Schroeder continue," he said.
"So whatever differences there may or may not have been on Iraq, nevertheless on common European objectives, on fighting terrorism, on taking on a whole
series of challenges that face us there is a common position.
"I am sure that can be worked on as well."