Over a dozen countries, including major donors the United States, Germany, Britain and Sweden, have suspended their funding to the agency over accusations that 12 of its staff members were involved in the October 7 sudden attacks in Israel by Hamas.
UNRWA, which has received a Norwegian nomination for the Nobel Peace Prize, has warned it will have to cease operations by the end of February if the funding is significantly pulled.
"Spain will release an urgent envelope of 3.5 million euros so that UNRWA can maintain its activities in the short term," Spanish Foreign Minister Jose Manuel Albares told a parliamentary committee.
"UNRWA's situation is desperate and there is a serious risk that its humanitarian activities will be paralysed in Gaza within a few weeks," he said.
European Union foreign policy chief Josep Borrell said on Sunday that the suspended total funds currently amount to "more than $440 million, or around half the agency's expected funds for 2024".
In response to the October 7 sudden attack, Israel vowed to wipe out Hamas.
Israeli prime minister Benjamin Netanyahu said last week that the UN agency had been "totally infiltrated" by Hamas, which has ruled Gaza since 2007.
Israel has responded to the attack with an air and ground offensive that has killed 27,365 people, mainly civilians, according to a Hamas health ministry toll updated on Sunday.
Spain is one of the most critical voices in Europe of Israel's offensive against Hamas