Roberto Vila Sexto, 32, who worked for a Spanish charity called Co-operation Assembly for Peace, was seized by armed men in the Gaza Strip on Monday.
The Palestinian official, speaking on condition of anonymity, said Vila's release was secured after security officials managed to identify the abductors and pressure them to release their captive.
"We will continue to chase the kidnappers and bring them to justice because these actions harm the image of the Palestinian people and Spanish-Palestinian relations," he said.
Celine Gagne, a colleague of Vila's, said they were leaving the town of Khan Younis after visiting a project for handicapped children when three or four men carrying Kalashnikov rifles stopped them.
Sexto had been working in the Gaza Strip and the West Bank for two years, according to the organisation's spokeswoman in Madrid.
Fawzi Barhoum, a spokesman for the ruling Hamas group, condemned the kidnapping. "These groups that are behind these acts do not represent the Palestinian tradition, culture and religion," he said.
Tawfiq Abu Khoussa, a spokesman for the rival Fatah party, had called for the immediate release of Vila.
"The protection of our foreigner friends is a collective responsibility for all Palestinians," he said.
Last week, a Spanish photographer for the US-based Associated Press news agency was held by gunmen for 15 hours before being released unharmed.
Emilio Morenatti was seized by four masked armed men as he left his home in the centre of Gaza City on October 24. No one claimed responsibility for his abduction.
Kidnappings of foreigners by armed men demanding money or job guarantees from the government have increased in the impoverished and increasingly lawless Palestinian territory.
Most of the foreigners have been released unharmed within days.