Latvia's Gatis Smukulis of HTC-Highroad retains the overall lead after winning Monday's first stage.
Petacchi, 37, of the Lampre team, edged Spain's Jose Joaquin Rojas of Team Movistar at the line in a stage marked by a breakaway some 20 kilometres from the finish.
"My teammates worked to neutralise the escape and afterwards (Daniele) Pietropolli and (David) Loosli escorted me until the sprint," said Petacchi.
News that makes sense
Your trusted source for staying up-to-date with the world around you. Get free daily news updates and analysis, straight to your inbox.
But "Rojas was a tough rival," he added.
The favorites, including three-time Tour de France champion Alberto Contador, finished with the peloton.
"I'm happy with these two first stages, I didn't lose time and haven't suffered any falls," said Contador.
"Yesterday was a pretty hard day to be the first stage, and today the last part was very dangerous.
It started to rain just as we entered into it, everyone wanted to be in front and it was a bit more risky than I would have wanted."
He said Wednesday's stage "will be crucial for the overall standings... Everything depends on how the breakaway happens in the final climb".
The race, which is celebrating its centenary and aside from Contador includes a top class field including in-form Australian Cadel Evans, continues on Wednesday with a 183.9-kilometre ride from La Vall d'en Bas to Andorra in the Pyrenees mountains.

