Having trailed twice in the previous round before winning in five sets, Ferrer struggled initially to create opportunities on Dodig's serve and was two points from going two sets down.
But he dominated the final two sets, breaking Dodig five times and clinching the match with a forehand winner.
Coming off his first career Grand Slam final at the French Open, Ferrer reached his second straight Wimbledon quarterfinal.
He will play the winner between No. 8 Juan Martin del Potro and Andreas Seppi.