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.

READ MORE: Dodgers.com