They named the dead as Khaled Al-Rabai, 14, and Ali Al-Ashqar, 17. Seventy protesters were wounded, 38 of them by live fire, medical officials said.
Al-Ashqar was shot in the neck in northern Gaza Strip and al-Rabai was hit in the chest in east Gaza City, doctors and the health ministry said.
The IDF said that troops guarding the border were faced with more than 6,000 demonstrators "especially violent" protests at several points along the fence.
It said the demonstrators hurled "a large amount of explosive devices, grenades and firebombs" and damaged parts of the fence.
The army also detained two Palestinians who crossed the frontier into Israel.
Protesters have staged 18 months of weekly demonstrations dubbed the "March of Return", calling for an end to a security blockade imposed on Gaza by Israel and Egypt, and for Palestinians to have the right to return to land from which their families fled or were forced to flee during Israel's founding in 1948.
Israel rejects any such return, saying that would mean an end to the Jewish state.
It says the security blockade is necessary to stop weapons reaching Islamist group Hamas, which has fought three wars with Israel and fired thousands of rockets at its population centers in the past decade.
The United Nations envoy to the region Nickolay Mladenov condemned the shooting of the two teens and called it "appalling!"
He wrote on Twitter that Israel "must calibrate its use of force, use lethal force only as a last resort, and only in response to imminent threat of death or serious injury." He also urged protests to be peaceful and called for ending "the cycle of violence."
Two #Palestinian teenagers killed today at the #Gaza protests. Appalling! #Israel must calibrate its use of force, use lethal force only as a last resort, and only in response to imminent threat of death or serious injury. Protests must be peaceful. The cycle of violence must end— Nickolay E. MLADENOV (@nmladenov) September 6, 2019
Egypt, Qatar and UN officials have been working to keep the border calm in recent months.
Around 210 Palestinians have been killed since the protests began in March 2018, Gaza medical officials say.