Spain will probe "human rights violations in Gaza" to assist the International Criminal Court, which has sought arrest warrants for Israeli officials over alleged war crimes, the attorney general has said.
A statement said the attorney general had "issued a decree to create a working team tasked with investigating violations of international human rights law in Gaza" to "gather evidence and make it available to the competent body, thereby fulfilling Spain's obligations regarding international cooperation and human rights".
It comes as the UN investigator, who this week accused Israel of committing genocide in Gaza, said she sees parallels with the butchery in Rwanda, and that she hopes one day Israeli leaders will be put behind bars.
Navi Pillay, a South African former judge who headed the international tribunal for the 1994 Rwanda genocide and also served as UN human rights chief, acknowledged that justice "is a slow process".
But as late South African anti-apartheid icon Nelson "Mandela said, it always seems impossible until it's done", she told AFP in an interview.
"I consider it not impossible that there will be arrests and trials" in the future.

Ms Pillay's Independent International Commission of Inquiry (COI), which does not speak on behalf of the United Nations, issued a bombshell report on Tuesday concluding that "genocide is occurring in Gaza" - something Israel vehemently denies.
The investigators also concluded that Israeli President Isaac Herzog, Prime Minister Benjamin Netanyahu and former defence minister Yoav Gallant have "incited the commission of genocide".
Israel categorically rejected the findings and slammed the report as "distorted and false".
But for Pillay, the parallels to Rwanda - where some 800,000 people, mostly ethnic Tutsis and moderate Hutus, were slaughtered - are clear.
As head of the International Criminal Tribunal for Rwanda, she says watching footage of civilians being killed and tortured had marked her "for life".
"I see similarities" to what is happening in Gaza, she said, pointing to "the same kind of methods".
While Tutsis were targeted in Rwanda's genocide, she said "all the evidence (indicates) it is Palestinians as a group that is being targeted" in Gaza.
Israeli leaders, she said, had made statements, including calling Palestinians "animals", which recalled the demonising rhetoric used during the Rwanda genocide, when Tutsis were labelled as "cockroaches".
In both cases, she said the target population is "dehumanised", signalling that "it's ok to kill them".
The International Criminal Court has already issued arrest warrants for Benjamin Netanyahu and Yoav Gallant for suspected war crimes.

Ms Pillay said securing accountability would not be easy, highlighting that the ICC "does not have its own sheriff or police force to do the arrests".
But she stressed that popular demand could bring about sudden change, as it had in her home country.
"I never thought apartheid will end in my lifetime," she said.
Ms Pillay said that going forward, the commission aims to draft a list of suspected perpetrators of abuses in Gaza, and also explore the suspected "complicity" of countries supporting Israel.
That work will meanwhile be left to her successor, since Ms Pillay will be leaving the commission in November, citing her age and health concerns.
Before that, she said she had her visa ready to travel to New York to present her report to the UN General Assembly.
So far, she said, "I have heard nothing about that visa being withdrawn".
Read Latest Middle East stories
UAE could downgrade diplomatic ties if Israel annexes West Bank, sources say
The United Arab Emirates could downgrade diplomatic ties with Israel if Prime Minister Benjamin Netanyahu's government annexes part or all of the Israeli-occupied West Bank, according to three sources briefed on the Gulf Arab state's deliberations.
UAE is one of just a few Arab states with diplomatic relations with Israel and downgrading ties would be a major setback for the Abraham Accords - a signature foreign policy achievement of US President Donald Trump and Mr Netanyahu.
Israel's government has recently taken steps that could presage annexation of the West Bank, which was captured along with East Jerusalem in a war in 1967. The United Nations and most countries oppose such a move.
For Mr Netanyahu, whose coalition relies on right-wing nationalist parties, annexation could be seen as a valuable vote winner before an election expected next year.
Abu Dhabi warned Mr Netanyahu's right-wing coalition this month that any annexation of the West Bank would be a "red line" for the Gulf state but did not say what measures could follow.
The UAE, which established ties with Israel in 2020 under the Abraham Accords, was considering withdrawing its ambassador in any response, the sources told Reuters.
The sources, who all spoke on condition of anonymity, said Abu Dhabi was not considering completely severing ties, although tensions have mounted during the almost two-year-old Gaza War.
A source in Israel said the government believed it could repair its strained ties with the UAE, a major commercial centre seen as the most significant of the Arab states to establish ties with Israel in 2020. The others were Bahrain and Morocco.
No other Arab state has since established formal ties with Israel, which also has diplomatic relations with Egypt and Jordan, and direct contacts with Qatar, though without full diplomatic recognition.
In a sign of growing tension with Israel, the Gulf state last week decided to bar Israeli defense companies from exhibiting at the Dubai Airshow in November, three of the sources said. Two other sources, an Israeli official and an Israeli defence industry executive, confirmed the decision.
Israel's defence ministry said it had been made aware of the decision but did not elaborate. A spokesperson for the UAE embassy in Abu Dhabi said discussions over Israel's participation in the week-long trade show were continuing.
Israel's media were the first to report the move to block the firms from the UAE's flagship aerospace and defence event.
The UAE foreign ministry did not respond to questions on whether it was weighing downgrading diplomatic ties with Israel.
The spokesperson at the Israeli embassy in Abu Dhabi said that Israel was committed to the Abraham Accords and that it would continue to work towards strengthening ties with the UAE.
Emirati foreign ministry official Lana Nusseibeh had told Reuters and Israeli media on 3 September that any annexation of the West Bank would jeopardise the Abraham Accords and end the pursuit of regional integration.
That warning preceded Israel's air strike on Qatar last week, which targeted Hamas leaders, an attack that Anwar Gargash, diplomatic adviser to UAE President Sheikh Mohamed bin Zayed Al Nahyan, condemned as treacherous.
At an emergency meeting of Muslim nations in Qatar, convened in response to the strike, a communique was issued urging countries to review diplomatic and economic ties with Israel.
As part of the Abraham Accords, Mr Netanyahu promised to hold off annexing the West Bank for four years. But that deadline has passed and some Israeli ministers are now pressing for action.
Finance Minister Bezalel Smotrich this month said that maps were being drawn up to annex most of the West Bank, urging Mr Netanyahu to accept the plan. Itamar Ben-Gvir, the national security minister, also backs annexing the territory.
After establishing ties, the UAE and Israel built a close relationship, focusing on economic, security and intelligence co-operation. This followed years of discreet contacts.
But differences began emerging after Mr Netanyahu returned to power in 2023, leading the most right-wing government in Israel's history. Abu Dhabi has condemned repeated efforts by Mr Ben-Gvir to alter the status quo of Jerusalem's Al Aqsa compound to allow Jews to be able to pray there.
The site is sacred to Muslims and Jews and at present non-Muslims can visit but cannot pray.
The UAE has also criticised Israel's policies in the West Bank and its military siege of Gaza, which began in October 2023 after Hamas launched a surprise attack on Israeli soil.
Abu Dhabi has said that an independent Palestinian state alongside Israel was necessary for regional stability. Mr Netanyahu this month declared there will never be a Palestinian state.