Police stopped Enrique López after he ran a red light in downtown Madrid early on Sunday morning, Spain’s ABC newspaper reported.
He was not wearing a helmet and breathalyser readings showed he was four times over the legal limit for alcohol.
Six hours later, the judge announced he would resign. “I am aware what I do was wrong and I accept the consequences,” he said of the decision.
The 51-year-old judge — allied with Spain's ruling Popular Party — now faces a maximum sentence of six months in prison, and could lose his licence for up to four years.
López’s resignation will not affect the balance of power in Spain’s Constitutional Court, which is made up of 12 judges. Conservative judges currently outnumber their so-called 'progressive' peers by six to five, with the final vote only being used when there is a stalemate over a court decision.
López’s replacement will be chosen by conservative Spanish Prime Minister Mariano Rajoy.
López's arrest is the second such traffic scandal involving a Popular Party figure in recent months.
In April, Esperanza Aguirre, former president of Madrid, caused a stir after she was fined by traffic cops on Madrid's emblematic Gran Vía and sped off moments after, knocking over a police motorbike.