The case will examine an Israeli air raid on July 22, 2002, on Gaza City which killed 14 civilians and a senior member of Hamas.
Andreu said the attack "showed signs of constituting a crime against humanity," the judicial source said.
"... anyone who considers the elimination of a terrorist a crime against humanity lives in an upside-down world"
Israel's defence minister
The judge said that the raid showed signs of being "disproportionate and excessive," and that Israel must have been aware of the "possible consequences" of dropping a one-tonne bomb in a heavily populated area.
Ehud Barak, Israel's defence minister, said in a statement that he "intends to fight vigorously against the accusations in Spain and do everything possible to get the investigation dismissed".
Barak said that he "vehemently rejects the delirious announcement by a Spanish judge", adding that "anyone who considers the elimination of a terrorist a crime against humanity lives in an upside-down world".
"All those in charge of defence have acted and continue to act in a proper manner in the name of the state of Israel, in the name of their duty to ensure the security of the citizens of Israel," the statement from Barak said.
Tzipi Livni, Israel's foreign minister told Miguel Angel Moratinos, her Spanish counterpart in a telephone conversation that "Israel is treating [the decision] with utmost gravity".
Livni said that the judge "decided to go ahead with the probe without being in possession of all the documents necessary to the case," a statement from the Israeli foreign ministry said.
Moratinos said that Spain "would do everything necessary for [the case] to have the least impact and have a satisfactory solution" but emphasised that the court should be independent.
In addition to Ben-Eliezer, the complaint names General Moshe Yaalon, Israel's army chief of staff, and General Dan Halutz, then head of the Israeli air force.
General Doron Almog, Giora Eiland, the national security council head, Michael Herzog, a defence ministry official, and Avi Dichter, director of the Shin Bet intelligence agency, are also subject to the case.
Andreu's decision to take on the complaint comes in the wake of Israel's 22-day war on Gaza.
Doctors in Gaza say that more than 1,300 Palestinians, nearly a third of them children, were killed during the recent attacks on the coastal territory.
Thirteen Israelis were killed during the operation, which had the stated aim of stopping rocket fire by Palestinian fighters from Gaza into Israel.