The car carrying Jose Efrain Garcia was shot at after it was blocked by several vehicles on the road between the towns of San Pablo Actipan and Tepeaca, prosecutors said on Twitter.
The mayor was critically wounded and died in hospital.
This is the latest death in a string of assassinations of mayors and other officials across Mexico. Last year, armed men shot and killed Soto Duarte, the mayor of Pungarabato, and Stalin Sanchez Gonzalez, the mayor of the Paracho.
More about: Mexico