Pittsburgh had not committed seven errors in a game in 27 years.
Castro had a two-run single in the third inning and added a two-run double during Chicago's five-run seventh. Pittsburgh made two errors during the seventh and had two more during the Cubs' three-run sixth.
Alfonso Soriano contributed three of Chicago's 12 hits along with three RBI. The Cubs won on the road for the first time in nine games.
Travis Wood (5-11) threw six shutout innings for the win, giving up only one hit with five strikeouts. It was his first victory since July 6, having gone 0-8 in his previous 10 starts.
A.J. Burnett (15-6) allowed seven runs, three earned, on eight hits in five-plus innings to take the loss.
Castro has 501 hits for his career, becoming the 28th player in baseball history to reach the 500 mark before his 23rd birthday.
2014: The Year in Music [PHOTOS]