Police intervened to free Jorge Luis Escandón Hernández, who suffered no major injuries after the ordeal.
A group of protesters armed with clubs and rocks detained the mayor of Las Margaritas and tied him to the back of a pickup truck and dragged him through the streets, according to local news website El Heraldo de Mexico.
Footage of the attack shows the man being dragged along a road, with a mob running after him.
It was the second attack by farmers demanding that he fulfil his campaign promise to repair a local road and bring drinking water and electricity to the community of roughly 500.
In an earlier incident four months ago, a group of men ransacked his office after turning up there and finding it empty.
Eight hours after the incident, the mayor appeared on the central square in Las Margaritas and gave a speech, holding leaders in the Santa Rita community responsible and saying he would not be intimidated.
Mayors and local politicians in Mexico are routinely targeted by drug gangs when they refuse to cooperate or accept bribes.
The Prosecutor General’s Office said 10 people were injured in the incident and 11 were arrested.
Mr Hernandez said he views the attempt as abduction and attempted murder and will press charges.