PITTSBURGH (AP) — Michael Chavis hit a bases-loaded single in the bottom of the ninth inning to cap a two-run rally and lift the Pittsburgh Pirates over the Cincinnati Reds 5-4 on Friday night.

The Pirates trailed 4-3 going into the final frame but tied it on Kevin Newman’s run-scoring double with one out. The Reds then intentionally walked Bryan Reynolds to put runners on first and second and brought in left-handed reliever Ross Detwiler to replace Joel Kuhnel (2-2).

Detwiler hit Ben Gamel to load the bases and Chavis lined a single into short left field.

The Pirates have won back-to-back games following a six-game losing streak.

Gamel had three hits. Newman added two hits and two RBIs, and Greg Allen and Bligh Madris also had two hits. Wil Crowe (5-7) got the win.

The Reds took a 3-0 lead behind home runs from Nick Senzel and TJ Friedl.

The Pirates rallied from the 3-0 deficit when Kevin Newman scored on a wild pitch in the sixth. An inning later, he hit a sacrifice fly before Gamel tied it with a single. Cincinnati then pulled ahead 4-3 on Kyle Farmer’s RBI single in the eighth.

Reds rookie Graham Ashcraft struck out eight in 6 2/3 innings while allowing three runs on nine hits and one walk. Pittsburgh’s Bryse Wilson gave up three runs and five hits in seven innings while striking out four and walking none.

SHELTON RETURNING

Pirates general manager Ben Cherington said prior to the game that manager Derek Shelton will return for a fourth season in 2023.

“I’m so happy with the level of effort he’s given to help us get better,” Cherington said. “I’m looking forward to this group benefitting from the fruits of his labor.”

TRAINER’S ROOM

Reds: 1B Joey Votto (torn left rotator cuff) was placed on the 60-day injured list after undergoing season-ending surgery on his shoulder Friday. The six-time All-Star is expected to be ready for the start of the next season, which will mark the final year of his 10-year, $225-million contract. … 1B/3B Mike Moustakas (strained left calf) was activated from the 10-day IL after being out since Aug. 9. … Senzel (strained right hamstring) returned to the lineup after missing three games. … INF Donovan Solano was expected to be reinstated from the paternity list but tested positive for COVID-19 and was transferred to the restricted list.

Pirates: RHP Mitch Keller (right shoulder fatigue) had his next scheduled start pushed back three days to next Wednesday against Atlanta. Keller left his start against Boston on Tuesday after two innings. RHP Zach Thompson will start Sunday against the Reds in Keller’s place.

UP NEXT

Reds: RHP Justin Dunn (0-1, 8.64) will be making his third start Saturday night since being called up from Triple-A Louisville.

Pirates: RHP Tyler Beede (1-2, 3.72) is 0-1 with a 6.75 ERA in three starts since moving from the bullpen to the rotation.