MILWAUKEE — Starling Marte’s return didn’t last long. The Pittsburgh Pirates’ stay in the NL wild-card race may not last too much longer.

Chris Carter hit his 37th home run, matching his career high, and Scooter Gennett sliced an opposite-field, two-run homer to help the Brewers avoid another sweep at Miller Park by the Pirates with a 3-1 win Thursday night.

Chase Anderson (9-11) allowed four hits in 5 2/3 innings, including a fifth-inning home run by Francisco Cervelli, his first since last Sept. 30.

Marte grabbed his lower back after fouling off a pitch in the third and left the game with what the team called back tightness. He had singled in the first inning after missing 16 consecutive games because of low back discomfort.

“If you saw the game, you saw the swings in the middle of the at-bat,” Pirates manager Clint Hurdle said in describing Marte’s two plate appearances. Those swings just aren’t going to play.”

Pittsburgh trails the Mets and Giants by 4 1/2 games for the NL wild-card spots.

“Minimal opportunities tonight,” Hurdle said. “We hit some balls hard, much like they did last night. We hit some balls hard, and they were in front of them.”

Pittsburgh had won six straight at Milwaukee, including the first two games of the series.

Anderson improved to 3-1 in five starts this season against the Pirates.

“Anderson has been on a good little run,” Hurdle said. “We’ve been able to win a couple of games, but he’s been pitching probably as good as he has in his career.”

Gennett homered to left field in the first against Ryan Vogelsong (3-6), who gave up two hits in four innings, struck out seven and walked two

“I thought I threw a pretty good curveball there,” Vogelsong said of the pitch Gennett hit. “He stayed behind it and hit it the other way.”

Vogelsong had won his previous four starts against the Brewers.

McCUTCHEN STAYS HOT

McCutchen has hit safely in 11 straight games against the Brewers and is batting .404 (19 for 47) with five runs, four doubles, three times, eight RBIs and three walks in that span.

McCutchen singled in the first inning, extending his hitting streak to 10 games, then doubled in the sixth to chase Anderson.

PIRATES ACQUIRE COKE

Pittsburgh acquired left-hander Phil Coke from the New York Yankees for $1. The 34-year-old reliever made three appearances in the middle of May before the Yankees designated him for assignment on May 17. He then went 5-3 with a 2.96 ERA in 20 regular-season appearances for Triple-A Scranton/Wilkes-Barre, including 11 starts.

“In the last two weeks, he’s started two times,” said. “There’s volume there. There’s experience out of the bullpen.”

Coke, who is expected to join the team in Pittsburgh on Friday, gives Hurdle a healthy arm in the bullpen.

“(A.J.) Schugel is down, (Neftali) Perez is down and (Jeff) Locke just returned to pitch Wednesday,” Hurdle said. “He (Coke) might have an inning in him to get him initially involved.”

TRAINER’S ROOM

Pirates: SS Jody Mercer wasn’t in the starting lineup due to right forearm discomfort but pinch hit for Vogelsong in the fifth and grounded out.

UP NEXT

Pirates: RHP Jameson Taillon (4-4) is to starts Friday’s opener of a three-game series against visiting Washington, his first outing against the Nationals.