Enrique Pena Nieto condemned the murder and ordered the attorney general's office to take over the investigation.
A federal judge whose court has handled some cases related to drug cartels has been killed near Mexico City.
Vicente Antonio Bermudez Zacarias was murdered in Metepec, a town in the State of Mexico, the Supreme Court said in a statement.
President Enrique Pena Nieto condemned the murder and ordered the attorney general's office to take over the investigation.
According to local media, Bermudez was shot in the head at point-blank range and succumbed to his wound while being taken to a hospital. The judge was exercising outside when he was killed, according to the newspaper Reforma.
State Governor Eruviel Avila said the shooting had been captured by a security camera.
Bermudez became a district court judge in December 2013 and served in the Fifth Tribunal for appeals and civil judgments in the State of Mexico when he was killed.
The court has handled cases related to organized crime, but the motive of his murder was not immediately known.
Bermudez's cases included one involving the Los Cuinis drug cartel and a tax fraud investigation against powerful businessman Naim Libien Kaui, whose family is accused of links to drug traffickers, Mexican media reports said.
"I have given instruction to the attorney general to take up this case, undertake the corresponding investigations and find those responsible for this terrible event," Pena Nieto said during an international meeting of judges that was scheduled before the murder.
Before the start of a public hearing, Supreme Court president Luis Maria Aguilar Morales urged the authorities to ensure the safety of judges.
"Federal judges are people who dedicate their lives, their personal, moral and physical integrity to serve federal justice in our country," Aguilar said.
"They require security and peace conditions that guarantee their independence because in an atmosphere of peace and security, judges can reflect on their decisions," he said, before holding a minute of silence.