The dramatic moment an off-duty Brazilian policeman shot dead one of three armed robbers who broke into his home garage to steal a car has been captured on camera.

Police have opened an investigation into the incident depicted in the clip that went viral online.

The security camera footage shows the officer, who has not been named, driving a white vehicle into the garage of his home in the Jardim Patrícia district of Uberlandia, a city about 400km south of Brasilia.

As the automatic door begins to shut behind the car and the policeman's wife is about to step out of the passenger seat, three men force their way into the room.

One, holding a gun, rapidly approaches the driver's door and moves to open it. He is however surprised by the officer who quickly draws his weapon.

The two men open fire almost simultaneously, with the robber having the worse of it. He is seen fleeing with his two accomplices after being hit, seemingly in the chest, while the policeman chases them to the door.

The wounded attacker, identified as Eliseu Santos Paulo, 32, later died at a city hospital, local media reported.

Investigating authorities said they have identified the other two robbers who however remain at large.

They are to submit the result of the probe to a local judge, who will then decide whether to press any charge against the policeman.

The local deputy police chief, Samuel Barreto, defended the officer, describing him as a dedicated veteran with more than 25 years of service, and said he acted in self-defence.

"Given the circumstances, if my officer didn't shoot, he could be the one who is dead now," Barreto told broadcaster G1. "In the online video you can see [the robber] opening fire on him and his wife".

The attempted robbery reportedly happened on 14 May.