The army said in a statement that militants who killed Dvir Sorek, 18, outside a settlement near Hebron were arrested and the car they used in the attack was seized. Israel's Channel 13 TV reported that the suspects included two brothers from Hebron.
There was no immediate Palestinian comment. The body of Sorek was found with stab wounds near his seminary, where he studied Talmud as part of a program combining military conscription with religious classes.
Israeli Prime Minister Benjamin Netanyahu praised intelligence and security forces for locating and arresting the suspects. "We will continue to fight terrorism intensely on all fronts," he wrote on his Twitter account.
Hamas, the militant group controlling the Gaza Strip, accused the Palestinian Authority, its rival in the West Bank, of cooperating with Israel to identify the militants behind the killing. "We have always warned against the security liaison between the Authority's security in the West Bank and the occupation army," Hamas spokesman Hazem Qassem said.
In Gaza, morning clashes along the frontier stoked fears of escalation after months of uneasy calm. This was the highest number of Palestinians killed in a single day since May, when an unofficial cease-fire ended the worst bout of violence in years between Israel and Hamas.
Lt. Col. Jonathan Conricus, an Israeli military spokesman, called it a "very significant attempt to attack Israel." "We hold Hamas responsible and accountable for any acts of violence emanating from the Gaza Strip whether they were Hamas operatives or not," Conricus said at a briefing with reporters.
No Palestinian groups claimed responsibility. Hamas, in a statement denying its involvement, stressed that it was an "individual act by angry youths." "The occupation is responsible for the state of anger and pressure inflicted on our people due to the continued siege on Gaza," said Abdel-Latif al-Qanou, a Hamas spokesman.
Conricus said the four were armed with automatic rifles, hand grenades and rocket propelled grenade launchers. He said Israeli soldiers opened fire when the militants tried to climb the fence, and that the militants returned fire before being killed. No Israelis soldiers were hurt.
Early in August, Israeli troops shot and killed a Palestinian militant who opened fire at forces behind the fence. Three soldiers sustained light to moderate wounds. The Gaza-Israel frontier has remained tense despite the cease-fire.
Hamas has staged weekly demonstrations along the boundary since March 2018 to protest against the strip's dire conditions following 12 years of Israeli-Egyptian blockade. The militant group canceled this Friday's protest because of the upcoming Muslim holiday of Eid al-Adha.
Associated Press writer Ilan Ben Zion contributed to this report from Jerusalem.