PHILADELPHIA (AP) — Bryce Harper put his head down and sprinted from first base as soon as J.T. Realmuto lined an opposite-field shot to right.

He waited for his cue from Phillies fans to figure out how far he should take his breathless dash.

“I heard the crowd roar once it landed,” Harper said, “and I kind of kicked it into another gear.”

Realmuto hit a two-run triple with two outs in the 10th inning — scoring Harper with the winning run on a headfirst slide into home — to rally the Philadelphia Phillies past the Baltimore Orioles 3-2 on Tuesday night to keep pace in the NL East.

“There's no chance I wasn't going to try and score right there,” Harper said.

Down 2-1 and with an automatic runner on third, Orioles righty Cesar Valdez (2-2) intentionally walked Harper. Realmuto hit a shot to right field past the outstretched glove of Anthony Santander, and Harper's winning run set off a wild celebration on the infield.

Realmuto delivered the clutch hit the Phillies badly needed against the 103-loss Orioles. Valdez was the last of eight Orioles pitchers.

“I didn’t want Harper to beat us there,” Orioles manager Brandon Hyde said. “Realmuto’s an All-Star superstar, superstar player. We didn’t want him to beat us there, as well.”

The Phillies earned their 12th walk-off win of the season. They are 77-74 with 11 games left this season as they try and make the playoffs for the first time since 2011.

They remained three games behind Atlanta in the NL East and are chasing three teams for the second NL wild-card spot.

Atlanta's late game at Arizona was on TVs in the Phillies clubhouse.

Austin Hays drove in automatic runner Cedric Mullins with a single off Ian Kennedy (3-1) in the 10th inning. But Realmuto provided the late-game thrill that helped the Phillies rebound from a loss in the opener of the three-game series.

Harper was thrown out twice on the basepaths and crushed the Phillies with careless baserunning in the eighth.

Harper, thrown out at second earlier in the game trying to stretch a double, ripped his career-high 39th double of the season off Fernando Abad to lead off the eighth. He moved to third on a groundout and pinch-hitter Matt Vierling hit a grounder to second baseman Pat Valaika.

With the infield in, Valaika nailed Harper standing up at home.

“It can't happen,” Harper said. “I saw the ball down. I kind of got off a little too far, hesitated a little bit and decided to go.”

Without a fifth starter, the Phillies again turned to a bullpen game in front of a paltry 18,955 announced fans. The Phillies trailed 7-0 to Chicago last Thursday in their previous bullpen outing and rallied for a 17-8 win.

Adonis Medina, a 24-year-old righty, lasted 3 2/3 innings in his first start and only second appearance of the season. Medina gave up a leadoff double to Mullins and then drilled Hays in the back in the first inning but pitched out of the jam.

He went 4-5 with a 5.05 ERA in 17 starts this season for Triple-A Lehigh Valley.

“I figured he was going to pitch at some point during this game tonight anyway, so why not do something that he’s comfortable with and start him?” manager Joe Girardi said.

Ramon Urias’ RBI single to center off Medina in the fourth gave the Orioles a 1-0 lead. Andrew McCutchen's RBI double in the sixth tied the game 1-all and snapped an 18-inning scoreless streak for the Phillies.

TRAINER’S ROOM

Orioles: OF DJ Stewart was placed on the 60-day injured list. He’ll have right knee surgery in the coming days and Hyde said that he should be ready for spring training. Hyde said that Stewart, who hit .204 with 12 home runs and 33 RBIs, had been getting treatment for the injury for some time.

“Everybody felt it was the right time for him to shut (it) down and take care of it and be ready for spring training next year,” Hyde said.

UP NEXT

The Phillies send ace RHP Zack Wheeler (14-9, 2.83 ERA, 231 strikeouts) to the mound against Baltimore LHP Keegan Akin (2-10, 6.93).

___

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