Updated

The Tampa Bay Rays were nursing a one-run lead when manager Joe Maddon pulled starter Jeremy Hellickson and turned to Joel Peralta to get the final out in the seventh inning.

Nick Johnson was at the plate for the Baltimore Orioles, and Maddon loved the matchup.

"I liked Joel on Johnson," Maddon said later. "I feel great about Joel Peralta in any situation."

Maddon's hunch backfired. Johnson hit his first homer in two years, a two-run drive that gave the Orioles a 4-3 victory Friday night in a duel for first place in the AL East.

Johnson was hitting .143 before going deep against Peralta on a 3-2 pitch. The ball landed in the first row of the right-field bleachers and put Baltimore in front for the first time in the game.

"I felt really good about Joel right there," Maddon said. "He gets the two strikes. Nick Johnson is always going to work you and get a good at-bat. With two strikes, I did not see that one coming. That was kind of out of left field. Out of right field, actually."

As the pitch soared toward the outfield, Peralta (0-2) squatted on the mound and could only hope the ball stayed in the park.

It didn't.

"I got ahead in the count like I was supposed to," the right-hander said. "Then I throw some really good pitches that I thought for sure he was going to swing at. He didn't. I know he's a good hitter. In the end, I just throw a fastball that was supposed to be down and away. I missed the spot and he got it. That was the game right there."

The Rays and the surprising Orioles came into the game tied atop the division with 20-12 records. It was the first time since June 9, 1992, that a two-way tie for first place in the AL East this late in the season didn't involve either New York or Boston.

Adam Jones and Nick Markakis also connected for the Orioles, who lead the majors with 53 homers. Johnson's homer was his first since May 5, 2010, with the Yankees.

"I squared it, but I didn't know I got it," Johnson said. "I think the wind blew it out. I put a good swing on it."

Darren O'Day (3-0) pitched the seventh, Pedro Strop worked a perfect eighth and Jim Johnson got three straight outs for his 10th save.

Tampa Bay, which was hitless after the fifth inning, has lost five of six. Rays designated hitter Luke Scott, who played the previous four seasons with Baltimore, went 1 for 3 with a walk and scored a run.

Dana Eveland walked six and hit two batters over six innings in his Orioles debut, yielding three runs and five hits. Obtained in a December trade with the Los Angeles Dodgers, Eveland toiled in the minors for Baltimore before being summoned for this game.

The Rays loaded the bases with no outs in the second inning but got only one run, on a double-play grounder by Sean Rodriguez.

Jones tied it in the bottom half with his 10th home run, a drive deep into the left-field seats on a 3-2 pitch.

Tampa Bay took a 3-1 lead in the fourth, but might have had more if not for a gritty play by Orioles catcher Matt Wieters. With the bases loaded and one out, Elliot Johnson hit a liner off the right-field wall that scored Matt Joyce and sent Rodriguez hustling from second to home.

Markakis threw to second baseman Robert Andino, whose relay got to Wieters an instant before Rodriguez arrived. Rodriguez led with his left shoulder and barreled into Wieters, who made the tag and held onto the ball despite being thrust backward several feet.

"I knew it was going to be a bang-bang," Wieters said. "I wasn't sure he was going to slide or come in strong, and I made sure to hold onto the ball."

Said Rodriguez: "He's definitely bigger than me. His foot was in front of the bag so I was like I got nowhere to slide, I got to get him, try to see if I could knock it loose. He held on to it. Credit to him."

Eveland then issued an intentional walk to load the bases before hitting Carlos Pena with a pitch to force in a run.

Markakis hit his sixth homer, the third in four games, to make it 3-2 in the sixth.

NOTES: To make room for Eveland, the Orioles placed RHP Matt Lindstrom (finger) on the 15-day disabled list. ... Tampa Bay OF Desmond Jennings missed a fourth straight start with a left knee sprain. ... Baltimore Ravens safety Ed Reed threw out the ceremonial first pitch. He also took batting practice before the game. ... Pena went 0 for 4 and is 3 for 35 with 13 strikeouts in his last nine games.