The attacker, who was a resident of occupied East Jerusalem, entered a border guard post and wounded the two before being shot dead. One of the guards was seriously injured, the other more lightly, police added.
Israel annexed Arab East Jerusalem after the 1967 war.
A wave of violence that broke out in October 2015 has killed 255 Palestinians, 40 Israelis, two Americans, one Jordanian, one Eritrean and one Sudanese, according to an AFP count.
Others were killed during protests, in clashes or during air raids on Gaza.