It was not clear whether the man turned the gun on himself after the shootings or was shot by police in Cebu City, capital of Cebu province.
ABS-CBNnews.com reported the man killed two people and wounded an assistant prosecutor before turning the gun on himself. Another report said he was shot by a responding policeman.
The ABS-CBN said the attacker fired his weapon inside the Marcelo Fernan Hall of Justice, killing two people, identified as Rene Rafols, a pediatrician, and his lawyer Jovian Atias, who died at the scene.
Later the gunman wounded assistant city prosecutor before turning the weapon on himself, the report said. The prosecutor was reported in critical condition at a hospital.
The Philippine Star reported the 65-year-old gunman had been accused of malicious mischief and was at the court for a hearing. But the reason for his sudden outburst was not known immediately.
The Star said initial reports indicated that while the hearing was on, the gunman pulled out a firearm and shot the complainant, Rafols, and his lawyer Atias.
The Star said a responding police officer later shot the attacker. It quoted other reports as saying the assailant also was battling a deportation case.
The report said it was not clear how he managed to bring a gun inside the court.