Thomas Raabe, a German defence ministry spokesman, said on Friday that the ship, the 83-metre Alster, was 90km off the coast in international waters when six Israeli F-16s flew over it and unaimed shots were fired in the air.
The unarmed ship was there as part of efforts to protect the United Nations Interim Force in Lebanon (Unifil) naval force, he said, noting that Israeli vessels had been hit with missiles during fighting with Hamas.
However, Raabe confirmed that the ship was not listed as part of the German flotilla sent to prevent weapons smuggling off the coast of Lebanon to complement the expanded Unifil peacekeeping force.
Asked what the motive for the jets' overflight was, he said: "I don't want to speculate. I don't think there is a serious background."
He added that Israel had high security needs given the situation in the Middle East.
Raabe would not say how Israel explained the incident to Germany's government.
No shots fired
Israel issued a statement saying that the jets approached a helicopter after it took off Tuesday from a German ship without notifying Israeli forces.
The Israelis denied shots were fired but stated that flares had been discharged by the fighters.
The Israeli statement said: "On October 24 at 9am, a German ship and a German helicopter were sighted near the shore at Rosh Hanikra. The helicopter did not have authorisation to fly there and the air force deployed planes to the area. No shots were fired. We can't detail how many planes there were."
Asked about the helicopter, Raabe said: "I can only say that this helicopter was 60km from the Alster."
He said the helicopter was carrying Andreas Krause, the admiral who is the German commander of Unifil naval task force.
The matter was raised in the German parliament on Friday by opposition politicians who opposed Germany's participation in the UN force for fear that German and Israeli troops could clash, a sensitive matter given Germany's role in perpetrating the Holocaust.
They demanded an explanation of what German personnel would do if overflown by Israeli jets again.
Guido Westerwelle, leader of the opposition Free Democrats, said: "This is exactly the situation we always warned about."
The Free Democrats also accused the government of misleading parliament about the mandate of the naval force and its freedom to act against suspected weapons shipments to Hezbollah fighters.
According to German media reports, the force's ships are only allowed to operate within 10km of the Lebanese coast at the request of Lebanese authorities.
Thomas Steg, a German government spokesman, said the opposition accusation was an "absurdity".
He said co-ordination with Lebanese authorities was part of the UN force's task of strengthening Lebanon's sovereignty. He did not deny the reported restrictions on the task force's operations.