Another person was seriously injured when a man yesterday opened fire in Quinta do Conde, around 30 kilometres south of the capital, following what television reports called a row between neighbours.
A plainclothes policeman, who lived in the neighbourhood, was gunned down after rushing to the spot to investigate after hearing shots.
Another officer from a patrol team that was called to the scene was also shot dead, with a bullet to the head.
The third victim was a 23-year-old youth, said by local media to be the son of the plainclothes policeman who had intervened to try to assist his father.
The suspected shooter, aged 77, was arrested and taken to hospital after attempting to commit suicide with a hunting rifle, the spokesman said.