Cubs starter Jake Arrieta allowed two hits and struck out nine in seven smooth innings. He left with a 1-0 lead following Luis Valbuena's run-scoring single in the fourth.
Slumping slugger Curtis Granderson tied it with a two-out RBI single off winner Pedro Strop (2-4) in the eighth, snapping skids of 0 for 17 and 1 for 29. A diving catch by rookie center fielder Arismendy Alcantara moments earlier prevented more potential damage.
Castro led off the ninth and greeted closer Jenrry Mejia (5-6) with his 13th home run, an opposite-field drive that barely cleared the wall near the right-field corner.
Hector Rondon got three quick outs for his 17th save, finishing a four-hitter that ended Chicago's three-game losing streak.
Valbuena returned to the lineup and broke out of his slump with an RBI single off Mets rookie Rafael Montero, still looking for his first win after six major league starts. Montero delivered an encouraging performance, though, going 7 1-3 innings for the longest outing of his career.
Arrieta struck out three straight in the second and whiffed the 3-4-5 hitters in the fourth. He started a 1-6-3 double play after a leadoff walk in the seventh and was helped out of his toughest jam by Castro in the third.
With runners at the corners, the shortstop made a slick pickup and a nifty flip to start an inning-ending double play against Juan Lagares.
Cubs rookie Javier Baez drew a leadoff walk in the fourth, his first in 55 major league plate appearances. Two outs later, Valbuena snapped a 1-for-32 slide with an RBI single.
Cubs: Valbuena, who had been fighting a cold, was back at 3B after not starting the first two games of the series. ... Prized prospect Kris Bryant was expected to have an MRI after leaving Saturday's game with Triple-A Iowa because of a sore left big toe. The team said Bryant had been playing through the injury for a few days, and X-rays were inconclusive. ''All indications are he's OK,'' manager Rick Renteria said.
Mets: As expected, 3B David Wright was out of the lineup with a sore left shoulder. Wright left Saturday's game one inning after he was hit by a fastball in the back of the shoulder, aggravating an area that's bothered him all summer. Eric Campbell started at third. ... Rookie RHP Jacob deGrom (rotator cuff tendinitis) threw about 20 pitches, all fastballs, in a bullpen session and said he had no problems. He'll throw a regular bullpen Tuesday or Wednesday, and so far it appears he's on track to come off the 15-day disabled list this weekend for a start at Dodger Stadium. ... Manager Terry Collins said he thinks RHP Daisuke Matsuzaka (elbow inflammation) will make another rehab start, this time for Class A Brooklyn. Matsuzaka allowed one run and three hits in six innings Saturday for Double-A Binghamton, throwing 69 pitches. ''Right now we're not sure where the fit's going to be when he's ready to pitch here,'' Collins said.
Cubs rookie Kyle Hendricks (4-1, 1.73 ERA) starts the four-game series finale Monday afternoon against 41-year-old Bartolo Colon (11-10, 3.85), who is 0-2 with a 4.73 ERA in five career starts against Chicago. Valbuena has two homers in five at-bats against Colon.