Updated

PITTSBURGH -- Max Moroff got his first career game-ending hit with a single in the 10th inning, pulling the Pittsburgh Pirates closer to the NL Central-leading Milwaukee Brewers with a 3-2 victory on Wednesday night.

Moroff raised his right arm and ran to first base while his seventh big league hit scored Josh Harrison. Teammate Gregory Polanco hoisted the rookie into the air as the Pirates celebrated their fourth straight win and 10th in 12 games. They are four games back of the Brewers. Pittsburgh and Milwaukee conclude a four-game set Thursday.

Harrison reached on a double against former Pirates reliever Jared Hughes (3-2), who got his first loss since April 18.

Pittsburgh blew a lead in the eighth before tying it in the ninth against closer Corey Knebel. Francisco Cervelli singled home Moroff, who was pinch-running for David Freese. The rally began with Freese's walk and Polanco's single. It was the fifth blown save this year for Knebel.

Domingo Santana hit a solo homer off Juan Nicasio in the eighth to give the Brewers a 2-1 lead. Santana also doubled and scored in the first and finished 3 for 4.

His homer was the second given up in the last four days by Nicasio, who hadn't allowed a home run all season until Sunday.

Tony Watson (5-2) pitched a scoreless 10th for the win.

Pirates starter Gerrit Cole went seven innings and struck out a season-high 10. It was the first time a Pirates pitcher has struck out 10 this season and the most for Cole since May 22, 2015. Six of his strikeouts were looking.

The Pirates tied it in the first when Starling Marte singled, advanced to third on Harrison's single and scored on Andrew McCutchen's sacrifice fly.

Milwaukee starter Zach Davies gave up an unearned run and eight hits over seven innings. He struck out four.

The Pirates nearly scored in the second, but Davies made a diving stop on a suicide-squeeze attempt by Cole and recovered in time to throw out Cervelli at home. That was the last time the Pirates advanced a runner into scoring position until the ninth.

TRAINER'S ROOM

Brewers: 2B Eric Sogard (left ankle strain) made his first rehab appearance with Class A Wisconsin. He went 0 for 3 with a strikeout. Sogard has been on the disabled list since July 6.

Pirates: 1B Josh Bell did not start but is expected to be fine after getting into a collision at first base with Eric Thames on Tuesday. He went 0 for 1 as a pinch hitter.

UP NEXT

Brewers: Jimmy Nelson (8-4, 3.27 ERA) will pitch in the series finale. Nelson has a team-leading 11 quality starts.

Pirates: Jameson Taillon (5-3, 3.06 ERA) will start. He has the team's best ERA among starters, but the Pirates are just 6-6 when he pitches.