In a statement, police said the attacker approached officers who were stationed in the Old City and stabbed one of them, injuring him lightly. The officers opened fire and shot and killed the man, identified as a 19-year-old resident of east Jerusalem. Israeli media reported a second officer was also lightly wounded as a result of the gunfire.
Police released a photo of a knife lying on a cobblestone alley in the ancient Old City, with blood splattered nearby.
Palestinians have carried out dozens of stabbing, shooting and car-ramming attacks — targeting Israeli civilians and security personnel in recent years. Many of the attacks have appeared to have had no links to militant groups.
Palestinians and rights groups have accused Israel of using excessive force in trying to subdue the attackers.
Israel captured east Jerusalem, including the Old City and its Christian, Muslim and Jewish holy sites, along with the West Bank and Gaza Strip in the 1967 Mideast war. It later annexed east Jerusalem in a move unrecognized by most of the international community.
The Palestinians seek the occupied West Bank and Gaza for a future independent state, with east Jerusalem as its capital.