GLENDALE, Ariz. -- Josh Beckett struck out three in two scoreless innings and the Dodgers got the jump on Giants starter Tim Lincecum before San Francisco rallied for an 8-8 tie Tuesday at Camelback Ranch.

Alex Castellanos slugged a two-run homer off Ramon Ramirez in the sixth inning to provide the Dodgers' final runs.

Lincecum escaped a first-inning jam with a strikeout/caught-stealing double play, but the Dodgers put eight consecutive batters on base in a five-run second inning with three consecutive hits off Lincecum, the rest reaching base off reliever Steve Edlefsen.

Non-roster invitee Jeremy Moore and Skip Schumaker contributed two-run doubles. Hanley Ramirez singled in the fifth run. Lincecum was charged with three runs in 1 1/3 innings, Edlefsen with two runs in two-thirds of an inning.

San Francisco scored in the third inning on a two-run double by Brandon Belt off J.P. Howell. The Giants closed the gap to 5-3 on Brett Pill's one-out homer off Dodgers closer Brandon League in the fourth inning.

Guillermo Quiroz cut the margin to a run in the sixth inning with a two-out RBI single to score Roger Kieschnick, who doubled. Brock Bond clubbed a two-run homer in the ninth, and Pill tied it with another two-run shot.

Yusmeiro Petit pitched two scoreless innings of relief for the Giants.

Up next: Two members of the starting rotation are expected to work back-to-back in Wednesday's Cactus League game against the Los Angeles Angels at Tempe, Ariz. Right-hander Ryan Vogelsong will start, followed by left-hander Barry Zito. Vogelsong pitched two innings last Saturday against the Angels and may try to work a third, since he needs to get ready for the World Baseball Classic. This will be the first Cactus League outing for Zito, who has looked sharp in his batting-practice sessions and while throwing on the side.