NEW YORK -- Thanks to a surprising comeback win Thursday night, the New York Mets snapped a four-game losing streak, but the result didn't change their approach as they try to work their way through an extended offensive drought.

"This is how we have to grind right now," Mets second baseman Neil Walker said late Thursday night following a 4-3 victory over the Chicago Cubs at Citi Field.

The Mets will host the Cubs again Friday night in the second game of a four-game series.

"This was a very, very good game for us, especially on the offensive side," Walker said. "We got to grind out at-bats, make the pitchers work, got ourselves some opportunities."

Walker was credited with the game-tying RBI in the seventh inning Thursday, when Alejandro De Aza scored from third on Walker's chopper to second base. Javier Baez tried throwing out Brandon Nimmo at third, but his throw sailed past Kris Bryant, and Nimmo raced home with the winning run.

The rally was keyed by De Aza, who worked an eight-pitch walk against Joel Peralta, and Nimmo, who ended a nine-pitch battle with a single off Peralta.

"We have to do this, day in and day out, to have some success until we get on a little bit of a roll," Walker said of the Mets, who scored just eight runs during their losing streak.

The loss ended a three-game winning streak for the Cubs, who led 3-0 in the sixth inning.

"You never want to lose a game when you have the lead," Cubs manager Joe Maddon said. "All losses are pretty tough to swallow, especially the close ones."

Still, the Mets (41-37) weren't the only ones who left Thursday night feeling pretty good about themselves. Maddon was encouraged by how close the Cubs (51-27) came to tying the game in both the eighth and ninth innings.

The Cubs had two on and two outs in the eighth, when pinch hitter Jason Heyward grounded out to end the threat. Chicago loaded the bases with one out in the ninth before Mets closer Jeurys Familia struck out Willson Contreras and induced Baez to pop out to first.

"It indicates the kind of tenacity our group has, and I love it," Maddon said. "I actually love every second of it."

The Mets are scheduled to send right-hander Jacob deGrom to the mound against Cubs right-hander Jason Hammel.

DeGrom will be looking to earn his first win in two months. He is winless since April 30, a 10-start stretch in which he is 0-4 despite a 3.13 ERA. In his most recent start last Saturday, deGrom threw eight scoreless innings but didn't factor into the decision in the Mets' 1-0, 11-inning win at Atlanta.

Hammel is looking to snap a four-start winless streak, during which he has gone 0-3 with a 3.70 ERA as his overall ERA has risen to a season-high 2.58. He took the defeat in his most recent start Sunday, when he gave up two runs over six innings in the Cubs' 6-1 loss to the Miami Marlins.

Neither starting pitcher has beaten his Friday opponent. In three career starts against the Cubs, deGrom is 0-2 with a 6.46 ERA. Hammel is 0-3 with a 4.91 ERA in five career starts against the Mets.