A Spanish aid worker has been freed unharmed hours after he was taken from his car near the southern Gaza town of Khan Younis, a Palestinian internal security official has said.