The three men who attacked the officers were killed, police said.
The attack was near the site known to Jews and the Temple Mount and to Muslims as Haram al-Sharif, the BBC reported.
Israeli police spokesman Micky Rosenfeld said the attackers were armed with automatic weapons, CNN reported.
“I can confirm that the two police officers who were previously in critical condition have died of their wounds in [the] hospital,” Rosenfeld told CNN.
Police said the gunmen opened fired as they made their way from the shrine toward Lions’ Gate, an opening in Jerusalem’s Old City walls. They were pursued back to the shrine and shot dead, the BBC reported.
The compound is the holiest site in Judaism and the third holiest in Islam.
Israeli Prime Minister Benjamin Netanyahu said the shrine will be closed Friday for security reasons, The Associated Press reported.