Updated

Here comes Evan Longoria and the Tampa Bay Rays — again.

Longoria hit a go-ahead homer and the Rays beat New York 5-2 on Tuesday night to drop the struggling Yankees into a tie for first place in the AL East.

Coupled with Baltimore's 12-0 win at Toronto, the Yankees fell into a tie for the division lead with the surging Orioles after sitting atop the standings by themselves for 84 consecutive days — New York's longest streak since 2004.

"It's kind of interesting this time of the year," Rays manager Joe Maddon said. "I love the energy of the games. I know it's not playoff time yet but they definitely have that feel to them. I think both sides are really keying into the game and I love it from dugout. Our players really thrive on the energy."

Desmond Jennings and Upton also homered for the third-place Rays, who pulled within 1½ games of the Orioles and Yankees. Tampa Bay, which put together a late surge to earn a wild-card spot last season, trailed by 10½ games at the end of play on July 18.

"We said from the start of spring training this is how it was going to be," Upton said. "A lot of people wrote it off when we were 10½ games out, but I've been around long enough to know that this is a long season. A lot of things can happen, especially with the second wild card in place."

"So we kept up our heads and we're playing good baseball," Upton added. "We find ourselves a game and half out in September. There's still a long way to go, a pretty tough schedule. We know what's ahead of us."

Yankees manager Joe Girardi wasn't around to see the end of this one. He was ejected by plate umpire Tony Randazzo in the fourth inning for arguing after Chris Dickerson was called out on strikes.

Longoria hit a two-run shot off Freddy Garcia (7-6) to wipe out a 2-1 deficit in the third inning. Jennings and Upton belted back-to-back shots in the fifth, giving Alex Cobb (9-8) and Tampa Bay's bullpen all the offensive support they would need against the Yankees' sputtering lineup.

Robinson Cano matched a career high with his 29th homer for New York, a two-run shot in the first inning.

Cobb allowed four hits over seven innings. Fernando Rodney earned his major league-best 42nd save in 44 opportunities.

Dickerson wanted timeout in the fourth, but Randazzo did not grant it and Dickerson went down looking to end the inning. Dickerson did not like the call and moments later Girardi came storming out of the dugout, yanked his cap off his head and argued face-to-face with Randazzo.

Before heading back to the dugout, Girardi kicked dirt in the batter's box.

Cano played despite experiencing tightness in his left hip reaching for a grounder that got past him for the game-deciding hit during the eighth inning of Monday's 4-3 loss to the Rays. He got treatment following the game and again early Tuesday before Girardi penciled him into the lineup.

The slugger has at least one hit in 13 of 14 games against Tampa Bay this season, including the past 11 — a stretch in which he's batted .438 (18 for 42) against a pitching staff that currently leads the major leagues in ERA and opponents' batting average, and tops the AL in strikeouts.

Longoria homered for the sixth time in 26 games since being activated following a three-month stint on the disabled list with a partially torn left hamstring. His 10th of the season came on a 2-2 pitch after Garcia prolonged the inning with a two-out walk to Ben Zobrist.

Jennings and Upton connected five pitches apart to begin the fifth. Upton, who hit a solo shot off CC Sabathia in Monday's series opener, also doubled on a 3-0 pitch to drive in Tampa Bay's first run of the night.

Garcia allowed five runs and five hits in 5 1-3 innings. It was the right-hander's first loss since July 30, even though Garcia had not pitched particularly well in two recent starts in which he wasn't involved in the decision against the White Sox and Indians.

NOTES: The Rays have won 11 of the last 12 games between the teams in Florida. ... Longoria started at designated hitter rather than his customary spot at third base as Maddon continues to take precautions with the injury that sidelined the three-time All-Star for 85 games. ... After the game, Tampa Bay recalled RHP Dane La Rosa and C-OF Stephen Vogt from Triple-A Durham