BALTIMORE — The Yankees’ offense needed a jolt after being shut out for two straight games, and on Sunday it came from an unexpected source.

Austin Romine, whose playing time has dried up significantly in recent weeks, delivered a two-out, two-run single in the first inning of the Yankees’ 5-2 victory over the Orioles, grounding a 1-and-2 pitch from Wade Miley through the hole into leftfield for a 3-0 lead.

“Really difficult,” Joe Girardi said of Romine not playing much of late but stepping up in a big spot and delivering. “I’m proud of what he did.”

Romine spent the first four months of the season as Brian McCann’s backup, but his playing time has taken a hit since Gary Sanchez supplanted McCann as the starting catcher. McCann, now the primary backup catcher, has gotten most of the action at designated hitter since Sanchez’s call-up, but with the lefthanded Miley on the mound, Romine got the nod at DH.

“It’s tough,” said Romine, who had only 22 at-bats in the month of August but never complained publicly. “These are big-league pitchers you’re talking about. It’s hard enough when you’re getting regular looks. Just staying ready, keeping my routine in the cage and being ready when he calls my name. I’m just trying to do my job every time I get in there.”

Didi OK

advertisement | advertise on newsday

Girardi gave shortstop Didi Gregorius a day off. He was hit by pitches in the lower left arm twice in the last week, most recently Saturday night. “His arm is sore,” Girardi said.

After the game, Gregorius said he expects to return Monday. “I’ll be fine,” he said.

Refsnyder gets start in left

Rookie utilityman Rob Refsnyder started in leftfield Sunday, only the second time this season he’s played the position.

“You look at what he’s done against lefthanders for us this year, it’s been really good. He’s been as productive as anyone,” said Girardi, who stacked righties in his lineup against Miley.

Yankees videos

Refsnyder, who went 1-for-2 with a walk and scored two runs, entered the game with a .264/.336/.328 overall slash line and a .277/.364/.362 slash line against lefties. He also has played games at third, second, first and rightfield.

Give me five

Sunday’s 5-2 victory made the Yankees 49-9 in games in which they have scored at least five runs. When they have scored fewer than five runs, they are 21-56 . . . Entering Sunday, the Orioles had recorded three straight shutout victories over the Yankees dating to the previous Sunday. Kevin Gausman started two of those games for Baltimore.