The agreement, sanctioning the deployment of 750 Egyptian border police on the Egyptian side of the Gaza Strip frontier to replace Israeli troops stationed in the volatile so-called Philadelphi Corridor, passed by a vote of 53-28 on Wednesday, the Knesset said.
The deal was approved by Prime Minister Ariel Sharon's cabinet on Sunday and brought to parliament after months of discussions, in which ministers demanded assurances Egypt would not allow weapons to move in and out of Gaza.
Some Israeli security officials have expressed concern that giving up the buffer could make it easier for armed Palestinian groups to slip more sophisticated weapons into Gaza.
Leading the unsuccessful charge against the accord, Netanyahu heaped scorn on Sharon, whose cabinet he quit just three weeks ago, refusing to take responsibility for the pullout from Gaza and part of the West Bank.
"It is important that we keep the Philadelphi road in our hands," he said, referring to the border route, "and certainly not give a port or airport to the Islamic terror base which is going to arise in Gaza."
Benjamin Netanyahu visits Maale
Adumim's city hall on Wednesday
But Defence Minister Shaul Mofaz, an ex-army chief of staff and Likud ally of Sharon, dismissed fears about turning the task over to Egypt.
"I want to tell all the members of the house who don't understand - reality has changed," Mofaz said.
"Israel cannot remain in the Philadelphi corridor when there is a better alternative that does not endanger Israel's security," he said.
Netanyahu is challenging Sharon for leadership of Likud party, basing his effort on opposition among registered members of the ruling Likud Party to the pullout.
An Egyptian flag flutters on the
Egyptian side of Rafah in Gaza
"He has created a precedent that will lead to the division of Jerusalem," Netanyahu told reporters during a tour of the 5km corridor between Jerusalem and Maaleh Adumim, Israel's largest West Bank settlement.
"My starting (my campaign) here is not coincidental because Jerusalem is in danger."
While the evacuation of all 21 settlements in Gaza and four in the West Bank has widespread public support, many ideologues in the traditionally pro-settlement party are opposed.
They control party institutions, giving Netanyahu a solid chance to unseat Sharon.
Call for removal
Speaking in Gaza on Wednesday, Palestinian President Mahmoud Abbas said all settlements "should be removed, from the first stone to the last stone", singling out the ones around Jerusalem.
Palestinians claim East Jerusalem as the capital of the state they want to create in the West Bank and Gaza. They charge that the Israeli plan to build in the Maaleh Adumim corridor is a way of cutting the West Bank off from East Jerusalem.
Israel evacuated all 21 Jewish settlements in Gaza and four of 120 in the West Bank in August under Sharon's plan to "disengage" from conflict with Palestinians.
The parliamentary action was little more than a technicality, changing the 1979 Israel-Egypt peace treaty to allow for posting 750 lightly armed Egyptian border police along the 13km stretch of desert from the Mediterranean Sea alongside Gaza to the Israeli border.
Israeli military forces are to pull out of Gaza by late September, handing control of the territory to the Palestinian Authority.