The Orica-GreenEdge rider beat Gianni Meersman, winner of the first two stages, by a bike's length at the end of 179km sixth stage from Almacelles to Valls.
Australian Gerrans, winner of the 2012 Milan–San Remo, was only fifth inside the final 100m but produced a devastating burst on the slight uphill finish to record his second win of the year.
Ireland's Daniel Martin retains his overall lead going into the final stage. He is 17 seconds ahead of Joaquim Rodriguez with Tour de France winner Bradley Wiggins fourth overall, 54 seconds behind, ahead of a 122km finale that features eight laps of a circuit featuring a climb to Montjuic.
Garmin-Sharp's Martin added three seconds to his GC advantage by winning the intermediate sprint after 30km.
A break then formed and Sylwester Smyd (Movistar), Egor Silin (Astana), Mikel Astarloza (Euskaltel), Alberto Losada (Katusha), Simone Stortoni (Lampre), Jesús Herrada (Movistar), Edmonson (Sky), Chris Sorensen (Saxo) and Daniel Navarro (Cofidis) crossed the category one climb of Alt de Prades ahead.
They had a 1:30 lead with 50km to go but were caught inside the final 8km, shortly after the descent of the category two Alt de Lilla to set up the bunch gallop.
Although there were a few time gaps at the finish with Wiggins losing 15 seconds to the top two on GC.