DETROIT — Chris Davis got some extra time Tuesday to show off his revived power stroke.

He needed to deliver a pair of long balls to finish off a 5-hour, 19-inning marathon.

READ MORE: Baltimore City Health Officials Says They Will Encourage Vaccinations For Young People

Davis smashed his second homer in as many innings, a two-run shot in the 13th, and the Baltimore Orioles snapped a four-game losing streak with a wild 13-11 victory over the Detroit Tigers on Tuesday night at Comerica Park.

Davis has four homers over his past three games after hitting the same amount in his first 33 games.

“I feel like I’m a little more calmer, a little more comfortable at the plate,” Davis said. “I had a tendency early in the year to try to be too aggressive and make that feeling appear as opposed to just slowing down and understanding it’s a long season.”

Davis’ 18th career multi-homer game allowed Baltimore (23-14) to survive a roller-coaster ride in which it squandered leads of six and three runs. He hit his second homer of the game off Francisco Rodriguez (1-5) after Mark Trumbo led off the 13th inning with his fourth hit, a double.

Trumbo tied the game at 8 with a two-out solo shot off Justin Wilson in the ninth.

“I thought Justin Wilson was throwing the ball really well,” Davis said. “For Mark to hit a home run right there and give us a chance was huge. I wasn’t trying to do anything special. Just trying to get a good pitch to hit and put a barrel on it. The ball I hit off K-Rod, I was just trying to get a ball in the air to the outfield to hopefully score a run.”

Baltimore manager Buck Showalter is glad to see his slugging first baseman break out of his slump.

“He’s been frustrated,” Showalter said. “I’ve said many times, ‘Can you imagine having that power at your fingertips and not being able to get to it every swing?’ Tonight, he put good swings on. Doesn’t matter if they’re left- or right-handed (pitchers) when he’s in a good spot.”

READ MORE: Baltimore Police Respond To Officer-Involved Shooting

Both teams scored three runs in the 12th. Davis sparked Baltimore’s outburst with a leadoff homer. Run-scoring singles by Ian Kinsler, Miguel Cabrera and Alex Avila tied the game in the bottom of the 12th.

“No bullpen is perfect. You think the Orioles’ bullpen is perfect? They also gave up a three-run lead,” Detroit manager Brad Ausmus said. “There are no perfect bullpens. Some bullpens are better than others, some have more talent, but there are no perfect bullpens. There is no ‘pen with a zero ERA.”

Ausmus took solace in seeing his team’s offense perk up after a 4-5 road trip.

“We’ve been struggling offensively and we swung the bats well and fought back twice, so I think that’s a plus,” he said. “You obviously want to win the game, but we didn’t roll over and play dead, either.”

J.J. Hardy homered and drove in three runs for the Orioles. Richard Bleier (1-1) pitched 1 2/3 innings to pick up the victory. Baltimore starter Wade Miley gave up four runs on eight hits in five-plus innings.

Orioles catcher Welington Castillo, who was activated from the 10-day disabled list prior to the game, had a two-run single among his three hits. Castillo missed 14 games with right shoulder tendinitis.

Detroit right fielder J.D. Martinez blasted two homers for the second time in three games, including a grand slam in the seventh.

J.D. Martinez, who came off the disabled list four games ago, also hit a solo shot in the third prior to his third career grand slam. He had a two-homer game against the Los Angeles Angels on Saturday.

Victor Martinez supplied a two-run homer for the Tigers (18-19).

MORE NEWS: Baltimore County Police Release 911 Calls In Woodlawn Shootings Saturday

Detroit starter Matthew Boyd lasted 2 1/3 innings, surrendering seven runs on eight hits. All of the runs he yielded came in the third inning.