Essex County prosecutors say the shooting occurred around 3 p.m. Sunday.
The officer, who also is a security guard at the supermarket, was reporting for work when he saw the robbery in progress. He immediately identified himself and tried to apprehend the robber, who showed a handgun.
The officer fired one shot which hit the suspect, who then fled the supermarket. But he soon collapsed and was taken to a hospital, where he died a short time later.
The officer was treated at a hospital for stress induced trauma. His name was not disclosed.
The shooting is under investigation by the prosecutor's office, which is standard policy in police-involved shootings.