NEW YORK, N.Y. - Following a long stretch of futility, Tampa Bay's fortunes have turned.

Logan Forsythe hit a tiebreaking single with two outs in the 12th inning and the Rays beat the New York Yankees 4-3 Monday night despite squandering a late lead.

"This is my own personal theory, is that to win on the road in extra innings really is good for a team's morale," Tampa Bay manager Joe Maddon said.

Kevin Kiermaier homered in his third straight game and Matt Joyce also went deep for the resurgent Rays, who have their first three-game winning streak since taking a season-best four in a row May 22-25.

They've won five of six overall and no longer own the worst record in the majors, a distinction that had belonged to them since June 4.

"Nobody quit," Maddon said. "To lose a game like this would have been really hard to walk in here. It's very difficult, and you don't know the negative complementary impacts it's going to have."

The only real bad news for the Rays was that shortstop Yunel Escobar is headed to the 15-day disabled list, retroactive to June 25, because of a sore right shoulder.

"Pretty much on target for a minimal stay," Maddon said.

Brian Roberts homered off Rays reliever Joel Peralta with one out in the ninth to tie it 3-all. As the ball cleared the right-field wall, Peralta crouched near the mound and pounded his fist into his glove.

But the scuffling Yankees were unable to muster any more offence and lost for the seventh time in nine games.

"They were able to get the big hits at the end and we weren't," manager Joe Girardi said. "We've had two extremely tough losses on this homestand."

Chris Archer nearly became the first pitcher in more than a century to win his first five outings against the Yankees, and Tampa Bay hurlers finished June with 287 strikeouts — breaking the major league record for one month set by the Chicago Cubs, who had 286 in August 2002.

"It was so special," Archer said. "We're going to be etched in stone for a while."

Brandon Guyer drew a two-out walk from Jose Ramirez (0-2) in the 12th and stole second. Forsythe lined the next pitch into centre field, scoring Guyer easily.

"Big boost in confidence. That's why we keep battling every game," said Forsythe, who also played excellent defence at second base. "We never think we're out of it, and it's great to be that guy tonight."

Brad Boxberger (1-1) pitched two perfect innings for his first major league win in 72 appearances.

"Really dominant kind of stuff," Maddon said. "He was in total command of the moment."

Archer went seven innings and was in line for the victory until Roberts homered. The last pitcher to start his career 5-0 in five games against New York was Washington Senators Hall of Famer Walter Johnson from 1907-08 — back when the club was still called the Highlanders.

The 25-year-old Archer has a 1.51 ERA in 35 2-3 innings against the Yankees.

Ryan Hanigan gave the Rays a 3-2 lead in the eighth with an RBI single off closer David Robertson. Hanigan's clutch hit came after Dellin Betances issued consecutive two-out walks.

"I couldn't make pitches with two outs," Betances said. "That's why I was so frustrated: I couldn't end the inning."

New York pitchers have walked 16 in the last two games.

Despite his team's record (36-49), Maddon is optimistic the Rays have turned things around in time to make a run. Tampa Bay's bats busted loose for 12 runs Sunday in Baltimore, and Joyce picked up Monday right where he left off.

Joyce, who tied team records with five hits and 12 total bases the day before, connected off David Phelps in the first inning for his third home run in two games.

Going into Sunday, Joyce had three homers all season — none since May 11.

Kiermaier, who had three hits, made it 2-0 with a leadoff shot in the third, but the Yankees finally broke through against Archer in the bottom half. Brett Gardner grounded an RBI triple inside first base and scored on Derek Jeter's groundout.

NOTES: When LHP David Price starts Tuesday night, he'll try to join Nolan Ryan, Randy Johnson and Pedro Martinez as the only pitchers to strike out at least 10 in six consecutive games. In 22 career starts against the Yankees, Price has never fanned 10. ... RHP Jeremy Hellickson (elbow surgery) threw 38 pitches in Florida and felt good, Maddon said. Now, the Rays will determine whether Hellickson's next rehab outing will be for Class-A Charlotte or Triple-A Durham. Hellickson ended his rehab start with Durham last Friday after three innings, complaining of discomfort. ... Rays CF Desmond Jennings was hit by pitches in the ninth and 11th. ... New York LHP CC Sabathia (right knee) threw a bullpen at Yankee Stadium and is scheduled to throw about 50 pitches in a rehab start Thursday for Double-A Trenton. "Hopefully, he's on the horizon," GM Brian Cashman said.