ST. PETERSBURG, Fla. -- The Yankees desperately needed someone to keep them from what would have been an embarrassing sweep at the hands of the Rays.

Robinson Cano -- don't you know -- was up to the job.

The second baseman came through with a go-ahead two-run single with the bases loaded in the eighth inning Wednesday to lift the Yankees to a 4-3 victory over the Rays in front of 28,033 at Tropicana Field.

Entering the at-bat, Cano was 1-for-13 with the bases loaded in 2012, but after falling behind 1-and-2, he lined a hit into centerfield off lefthander Jake McGee.

"Robbie gets up and gets a big hit,'' Joe Girardi said. "Tremendous win for us because this has been a tough place the first half of the season for us.''

The Yankees (49-32), who snapped their losing streak in this building at nine games, are off Thursday before starting a four-game series against the Red Sox Friday at Fenway Park.

advertisement | advertise on newsday

"It was good to get the monkey off our back,'' Cano said. "We didn't want to go to Boston losing three games [in a row].''

Cano's one-out single turned a 3-2 deficit into a 4-3 lead and made it eight straight games in which he has driven in at least one run. Cano, who hit .340 with 11 homers and 21 RBIs in June, is 8-for-17 with six RBIs in four games in July. He is batting .394 with nine homers and 20 RBIs in his last 17 games.

Former Yankee Kyle Farnsworth (0-1) provided the kindling for the rally, taking the mound in the eighth with a 3-1 lead and throwing 16 of his 26 pitches out of the strike zone. He walked four in the span of five batters, the last being Alex Rodriguez, whose walk on a 3-and-2 pitch made it 3-2. McGee then came on to face Cano.

Farnsworth's outing wasted an outstanding one by David Price, who Girardi said had "no-hit stuff.'' None of the guys who had to face him disagreed.

"It was good [stuff] today,'' Nick Swisher said, shaking his head. "I'm not much of a guy to give credit to pitchers, but sometimes you have to give it.''

Yankees videos

Price allowed one run and four hits in seven innings with eight strikeouts. The lefthander retired the first 10 batters and didn't allow a hit until Cano singled on the first pitch of the fifth.

The Yankees trailed 1-0 before Mark Teixeira tied it in the seventh with his 14th home run, a shot to left-center on a one-handed swing. "He didn't make any mistakes until that pitch,'' Teixeira said. "He was as good as I've ever seen him.''

A rarely seen play might have kept the Yankees from taking the lead later in the inning. After stealing third with one out, Alex Rodriguez was sent back to second because catcher Jose Lobaton made contact with plate umpire Mike Estabrook's mask on the throw and umpire's interference was called. Girardi did not argue. "What are you going to do?'' he said. "He hits the umpire. The only way it's not interference is if he throws him out.''

Rookie David Phelps, making his third start of the season, allowed one run and two hits in 41/3 innings before being pulled after 81 pitches. He struck out a career-high eight. "They made him work, but I thought he did a nice job for us,'' Girardi said.

Eventual winning pitcher Boone Logan (3-0) couldn't keep it at 1-1, giving up a two-run homer to Carlos Peña in the bottom of the seventh to make it 3-1. But David Robertson struck out two in a scoreless eighth and former Ray Rafael Soriano recorded his 19th save in 20 chances with a perfect ninth, retiring Peña on a pop-up to end it.

advertisement | advertise on newsday

"I thought it was really good,'' Robertson said. "Very fortunate that the team pulled through and scored a bunch of runs, too. It's a big win for us.''