Twenty-seven-year-old Gavazzi out-sprinted Belgian Kristof Vandewalle (Quick Step) after the pair had broken clear from their fellow escapees inside the final two kilometres of the hilly 175km stage.
The win was the biggest of the Italian's career and his third Iberian peninsula scalp of the season after previous victories in the Volta a Portugal and the Tour of the Basque Country.
Spainard Juan José Cobo (Geox) maintains his 13-second race lead over Britain's Chris Froome (Team Sky) after both riders arrived safely in the peloton, seven minutes and 42 seconds down on Gavazzi.
An initial break formed after just 10km of racing when 17 riders pinged off the front - including double stage winner Joaquim Rodriguez (Katusha).
The break built up a lead of almost 12 minutes as it crossed all five climbs of the day, but was whittled down to 11 riders on the most difficult climb of the day, the Cat.1 Puerto de Alisas, 55km from the finish.
An interesting duel played out between Italian Matteo Montaguti (Ag2R) and Belgian Nico Sijmens (Cofidis) as the former tried to eat into the lead held the latter's team-mate David Moncoutie in the king of the mountains competition.
With polka dot jersey Moncoutie not present in the group, Sijmens did a great job in denying Montaguti maximum points on all but one climb.
The Italian still picked up enough points to move within seven points of Moncoutie's position at the top of the KOM standings - with a maximum 34 points still available in the next two stages in the rugged Basque Country.
Montaguti found himself persona non grata in the leading group for apparently failing to pull his weight. The climber's chief critic seemed to be the Spaniard Rodriguez, who still managed to pick up maximum points in both bonus sprints to retake the green jersey that he lost to Rabobank's Bauke Mollema on Wednesday's final summit finish.
On the last Cat.3 climb of the day, 30km from the finish, RadioShack's Sergio Paulinho took his fellow escapees by surprise with a strong solo attack to build a lead of 45 seconds going over the summit.
The veteran Portuguese rider, who is out of contract at the end of the season, managed to maintain his lead as he reached the bottom of the descent - and when his chasers began to bicker, Paulinho looked an outside bet to win another Vuelta stage victory in Cantabria just as he had done in 2006.
But with 2km left to ride, Paulinho was finally swept up - just as Vandevalle made a timely counter-attack.
Only Gavazzi could follow the Belgian's wheel - and despite a late effort from Astana's Robert Kiserlovski, the leading pair entered the final kilometre with a 10-second gap on their chasers.
Vandevalle opened up the final sprint, but Gavazzi easily foiled him for pace - just as he had done back in April in the fifth stage of the Tour of the Basque Country.
The win was Lampre's first of the Vuelta after a disappointing three weeks for their main sprinter Alessandro Petacchi.
An Italian on the podium also meant that the previous 10 stages of the 66th Vuelta have now been won by riders from 10 different nationalities - a record in all three Grand Tours.
Skil-Shimano led the remaining escapees over the line nine seconds down, while an exhausted Paulinho rolled over a further minute back.
The race continues on Friday with the first of two stages in the Basque Country. It is the first time the Vuelta has visited the autonomous community since 1978.
The 158km stage 19 from Noja to Bilbao features four lower-category climbs and should see the riders of Basque team Euskaltel come to the fore in their distinctive bright orange jerseys.