Fireworks erupted prematurely over Yankee Stadium Friday night. No, not because there was still about a half hour to go before July 4, but because Mark Teixeira and Brian McCann hadn't brought the firepower quite yet.

Just as the colored blasts erupted overhead, Teixeira singled to right to drive in Brett Gardner from third and McCann followed it up one pitch later with a three-run blast to right as the Yankees overcame a two-run deficit to outlast the Tampa Bay Rays, 7-5, in 12 innings.

Teixeira's three-run homer had tied the score in the eighth.

"It's one of the best feelings you could possibly have," said McCann, who teed off on reliever Steve Geltz. "He hung a splitter the first time . . . [So] I was sitting on the middle of the plate and I got what I was looking for."

It was a celebratory end to an inning that seemed to take all the fire out of the Yankees. With runners on first and second in the top of the 12th, Chasen Shreve (6-1) allowed a one-out, go-ahead RBI single to Kevin Kiermaier. Rene Rivera's single made it 5-3.

Masahiro Tanaka, who struggled badly in his previous two outings, started for the Yankees and regained some of the control that Joe Girardi said has been evading him. He allowed three runs and six hits in six innings. He walked one and struck out five. It wasn't a completely impressive start, but far better when you consider that Tanaka hasn't had a win since June 9 and was 0-1 with a 9.90 ERA in his previous two starts.

advertisement | advertise on newsday

Tanaka was on the ropes almost immediately, allowing a leadoff double just inside the first-base line to Grady Sizemore, walking Joey Butler and then letting Evan Longoria work back from an 0-and-2 count to double to left, driving in Sizemore. James Loney's sacrifice fly to right gave the Rays a 2-0 lead.

"I'm not satisfied, obviously," Tanaka said. "Next time, I'm going to try to get things going from the start . . . It comes down to the mechanics -- a little tweak from the first inning on that brought me back."

Tanaka retired the side in order in the second and third and didn't allow another run until the fifth. Kiermaier tripled into the rightfield corner and scored on Rivera's sacrifice fly to right.

The Yankees were toothless for Rays starter Chris Archer's 62/3 innings, but feasted on reliever Kevin Jepsen, who allowed back-to-back, one out, eighth-inning singles to set the stage for Teixeira, who sailed a 1-and-0 changeup deep into the rightfield stands to tie the score at 3. It was his team-leading 20th homer. Jepsen then walked McCann and Garrett Jones but Brandon Gomes came in and induced Chris Young to hit into a 5-4-3 double play.

Archer allowed three hits and no earned runs with eight strikeouts. He walked three, hit a batter, but still had only three batters make it as far as second base. The Yankees managed only one extra-base hit against him, Didi Gregorius' double in the third. This, after the Yankees came into the game having averaged an MLB-best 5.77 runs per every home game, compared with their 2.57 road average.

Yankees videos

"The guys did a great job getting on base," after he left, Gardner said. "It was a great win . . . We never gave up right up to the last out."