Rookie Jacob Stallings hit a two-out single in the bottom of the ninth inning to rally the Pittsburgh Pirates to a 7-6 victory over the Kansas City Royals on Monday night.

After Jordan Luplow grounded into a double play, Kevin Kramer walked and moved to second on Kevin Newman's single. Stallings then singled into left field off Ben Lively (0-3), scoring Kramer.

It was Stallings' second career game-ending hit. The catcher also had one in 2016.

Pittsburgh Pirates starting pitcher Joe Musgrove delivers in the first inning of a baseball game against the Kansas City Royals in Pittsburgh, Monday, Sept. 17, 2018. (AP PhotoGene J. Puskar)

Pittsburgh Pirates starting pitcher Joe Musgrove delivers in the first inning of a baseball game against the Kansas City Royals in Pittsburgh, Monday, Sept. 17, 2018. (AP PhotoGene J. Puskar)

The Pirates scored twice with two outs in the eighth inning to tie the game at 6-all. The first run scored when first baseman Ryan O'Hearn failed to handle a throw from third baseman Hunter Dozier on a grounder by Pablo Reyes. Starling Marte followed with an RBI triple.

Newman had three of Pittsburgh's 15 hits, and the rookie shortstop extended his hitting streak to six games as the Pirates won for the ninth time in 12 games.

Edgar Santana (3-3) pitched a 1-2-3 ninth.

Kansas City Royals' Ryan O'Hearn drives in two runs with a double off Pittsburgh Pirates starting pitcher Joe Musgrove in the fifth inning of a baseball game in Pittsburgh, Monday, Sept. 17, 2018. (AP PhotoGene J. Puskar)

Kansas City Royals' Ryan O'Hearn drives in two runs with a double off Pittsburgh Pirates starting pitcher Joe Musgrove in the fifth inning of a baseball game in Pittsburgh, Monday, Sept. 17, 2018. (AP PhotoGene J. Puskar)

O'Hearn's 11th home run in 36 games since making his debut July 31 led off the top of the eighth and gave the Royals a two-run lead.

Bell drew Pittsburgh to 5-4 in the seventh with a run-scoring single.

O'Hearn's RBI double capped a four-run fifth inning and put the Royals on top 5-3. That followed consecutive run-scoring singles by Adalberto Mondesi, Alex Gordon and Salvador Perez.

Pittsburgh Pirates starting pitcher Joe Musgrove delivers in the first inning of a baseball game against the Kansas City Royals in Pittsburgh, Monday, Sept. 17, 2018. (AP PhotoGene J. Puskar)

Pittsburgh Pirates starting pitcher Joe Musgrove delivers in the first inning of a baseball game against the Kansas City Royals in Pittsburgh, Monday, Sept. 17, 2018. (AP PhotoGene J. Puskar)

Gordon doubled in the game's first run in top of the third inning, and Corey Dickerson countered with an RBI single in the bottom half. Frazier's two-run single in the fourth gave the Pirates a short-lived 3-1 lead.

Kansas City's Brad Keller allowed four runs and 10 hits in six-plus innings. Pittsburgh's Joe Musgrove also pitched six innings, giving up five runs and eight hits.

Keller got his first major league hit when he singled off Musgrove to lead off the fifth inning. It came in Keller's second career at-bat after he struck out in the second.

Kansas City Royals starting pitcher Brad Keller delivers in the first inning of a baseball game against the Pittsburgh Pirates in Pittsburgh, Monday, Sept. 17, 2018. (AP PhotoGene J. Puskar)

Kansas City Royals starting pitcher Brad Keller delivers in the first inning of a baseball game against the Pittsburgh Pirates in Pittsburgh, Monday, Sept. 17, 2018. (AP PhotoGene J. Puskar)

O'Hearn's homer to right field off Steven Brault was the first allowed by the left-hander in 117 career plate appearances against left-handed batters.

TRAINER'S ROOM

Pirates: 2B Frazier (right knee discomfort) left for a pinch-runner immediately after hitting his double. . C Francisco Cervelli (flu-like symptoms) was scratched from the original lineup. . C Elias Diaz (strained right hamstring) has been cleared to play after sitting out since Aug. 31. . Pitching coach Ray Searage underwent cervical surgery and assistant pitching coach Justin Meccage is taking his place.

AND 31 YEARS LATER .

Royals 2B Whit Merrifield played his first game in Pittsburgh. Merrifield's father, Bill, was called up by the Pirates for one day late in the 1987 season then sent to instructional league to make the conversion from third baseman to first baseman.

Bill Merrifield did not appear in a game and never returned to the major leagues.

REMEMBERING MAC

A moment of silence was held for rapper/singer Mac Miller, who died last week. Miller was a Pittsburgh native and Pirates' fan.

UP NEXT

Royals: LHP Eric Skoglund (1-5, 6.19) makes his third appearance and second start Tuesday night. He had been sidelined from May 26-Sept. 6 with a sprained ligament in his left elbow.

Pirates: RHP Jameson Taillon (13-9, 3.37) has allowed three earned runs or less in 19 straight starts.

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