NEW YORK (AP) — The only frustration for Yu Darvish during his longest outing with the Chicago Cubs was that one uncharacteristic walk.

Darvish pitched eight masterful innings, Javier Báez homered and drove in three runs, and the Cubs topped the New York Mets 5-2 Tuesday night to take the opener of a pivotal three-game series in the National League wild-card race.

The pinpoint right-hander from Japan issued his first walk in six starts since July 23. Todd Frazier drew a free pass leading off the fifth, ending a streak of 142 batters without a base on balls for Darvish.

“Sad about the walk. Four-pitch walk,” Darvish said, shaking his head.

“I tried to throw a strike, but I couldn’t throw a strike,” he added later. “So I feel like, embarrassed.”

Báez and Addison Russell each hit a two-run homer off Marcus Stroman, helping the Cubs improve to 26-39 away from home. Both middle infielders finished with three hits, and Báez had an eventful game all over the field.

The flashy shortstop made a snow-cone grab to thwart a potential rally, contributed three extra-base hits and a walk on a perfect night at the plate — and was thrown out twice being overaggressive on the bases.

“When Javy’s got it going on, he does it all,” Cubs manager Joe Maddon said. “That was just spry Javy out there today.”

Pete Alonso hit his 42nd home run for the Mets, becoming the first rookie in 81 years to break his team’s season record. J.D. Davis went deep with two outs in the ninth against Brandon Kintzler.

“I think winning the first game of this series is huge,” Russell said. “It kind of gets people thinking like, this Cubs team is actually really, really good.”

Following a five-game winning streak, New York dropped its fourth straight at home for the first time this season and fell three games behind Chicago for the second NL wild card. Philadelphia is two back of the Cubs, who trail first-place St. Louis by three in the NL Central.

“We’re just not getting the timely hit or the big hit when we need it to keep us rolling. It will change,” Mets manager Mickey Callaway said.

“We feel like we’re always on the brink, and I think that’s what motivates us.”

Darvish (5-6) allowed five hits and struck out seven in his deepest start since lasting eight innings with Texas at Tampa Bay on July 21, 2017. Still, he wasn’t completely satisfied.

“Stuff wasn’t sharp enough,” Darvish said. “Just game plan and pitch selection was — from me — perfect.”

Stroman (7-12) was handed a 1-0 lead but gave it right back when Russell connected in the fifth after Victor Caratini’s double off Michael Conforto’s glove in center field. Kris Bryant doubled to start the sixth and Báez hit an opposite-field homer to right.

“Mentally, situationally, we were a lot better today,” Maddon said.

Alonso homered on the first pitch from Darvish in the fourth, a no-doubt drive to the opposite field that soared far beyond the fence in right. This year’s Home Run Derby champion set the Mets season mark with 31 games to spare.

Todd Hundley in 1996 and Carlos Beltran a decade later hit 41 homers for New York.

“It’s such an amazing feeling,” Alonso said. “It’s been a dream come true for me so far this year, and I just feel really blessed and honored.”

Johnny Rizzo was the previous major league rookie to claim sole possession of his club’s home run record when he hit 23 for the Pittsburgh Pirates in 1938. Rizzo’s franchise mark was matched by Hall of Famer and former Mets broadcaster Ralph Kiner when he was a rookie in 1946.

STROMAN FADES

After a strong start, Stroman yielded four runs and six hits in six innings. He is 1-1 in five starts with the Mets since arriving from Toronto in a trade. They won his previous four.

Stroman exited his previous outing with hamstring tightness, but showed no ill effects.

“I need to do a better job after Alonso hits that homer, having a shutdown inning coming out that next half,” Stroman said. “I usually pride myself on that.”

GOING STREAKING

Mets catcher Wilson Ramos singled twice and extended his hitting streak to a career-high 20 games, best in the majors this year and longest by a Mets player since David Wright’s 20-gamer stretched over two seasons from 2007-08.

TRAINER’S ROOM

Cubs: 1B Anthony Rizzo sat out his second consecutive game after leaving Saturday’s loss to Washington with tightness in his back. … All-Star catcher Willson Contreras (strained right hamstring) was set to catch Jon Lester’s side session and is getting closer to a return from the injured list.

Mets: OF Brandon Nimmo played nine innings in center field and went 0 for 4 with a walk in his latest rehab game for Triple-A Syracuse. The club hopes to play him five innings Wednesday at Syracuse. Nimmo has been on the injured list since May 21 with a bulging disk in his neck. … 2B Robinson Canó (torn left hamstring) took batting practice and worked out on the field. He appears to be progressing ahead of schedule in his recovery.

UP NEXT

Cubs right-hander Kyle Hendricks (9-9, 3.20 ERA) pitches Wednesday night against Noah Syndergaard (9-6, 3.71 ERA). Both threw shutout ball to win last time out. Hendricks is 3-0 with a 0.47 ERA in three career starts against the Mets, though he hasn’t faced them since July 2016. Syndergaard has posted a career-best eight consecutive quality starts.

___

More AP MLB: https://apnews.com/MLB and https://twitter.com/AP_Sports