José Vicente Adsuara, a local councillor from Nules in Spain's Valencia region quit "because of the impact" of the photograph, regional daily Levante reported on Tuesday.
"I don't want to damage the image of my town, or my party, or my own (image)," he said in a written statement explaining his decision.
But the official also defended himself, saying the photo had been "taken completely out of context". It was "taken in a meeting with friends and was part of a joke", Adsuara said.
"There was nothing on the table," he added, referring to the image in which no cocaine is visible.
"I will keep fighting for my ideas, which are those of the Popular Party, although I realize that my priority right now is to defend my image publicly," he said.
"I have nothing to hide."
Adsuara has launched a complaint with Spain's Civil Guard police force in a bid to put the matter to bed "quickly and effectively".
His resignation has already been accepted by local party chiefs.