BOSTON — Alex Rodriguez got the raucous booing he expected and the victory his team needed.

Rodriguez drove in a run with a bases-loaded dribbler, capping a three-run rally in the eighth inning that lifted the New York Yankees over the Red Sox 4-2 on Thursday night and sent New York's polarizing designated hitter out of Boston with one last victory.

"It was a lot of fun to be out there," Rodriguez said after his only start in the series. "Kind of a funny hit at the end. Not how I pictured it when I woke up this morning, but definitely I'm glad that run came in and we won the game."

Rodriguez is set to play his final game for New York on Friday night at Yankee Stadium against Tampa Bay. The slumping 41-year-old will then be released and become an adviser and instructor for the team.

Rodriguez was 0 for 4 and loudly jeered throughout the game, which turned in the Yankees' favor on a crucial fielding mistake that allowed them to overcome a 2-1 deficit and take two out of three in the series.

Rodriguez lined out, popped out and struck out before his tapper in front of the plate in the eighth rolled maybe 10 feet — far enough for Brett Gardner to score from third and put New York up 4-2.

"That's how I'm going to remember it — the RBI," Rodriguez said. "I'm not going to tell anyone how it came."

Rodriguez has started twice in 18 games since July 22 and is in a 4-for-41 slide. He sat Tuesday in the opener and flied out as a pinch hitter in the Yankees' 9-4 win Wednesday — his first at-bat in more than a week. Manager Joe Girardi fulfilled an earlier promise to put him in the lineup Thursday and said he wasn't going to pinch-hit for Rodriguez in the eighth.

"I really thought he might hit a ball in the seats tonight," Girardi said. "But it ends up being a big run. It really does."

The RBI for Rodriguez came after the Red Sox intentionally walked Chase Headley with one out. And it punctuated the frustration for Boston fans who had just seen former Red Sox star Jacoby Ellsbury, booed almost as loudly as Rodriguez, hit a fly ball to left field that rookie Andrew Benintendi misread with the bases loaded.

"It went in the lights, but that's no excuse. I should have caught it," Benintendi said. "It's just one of those things. Not much you can do about it. I tried to put my glove up where I thought it was going to be."

The ball went past Benintendi, allowing two runs to score on what was originally ruled a sacrifice fly and error. After the game, it was changed to a two-run double.

The Yankees' other run came on Austin Romine's solo homer to left in the third.

Dellin Betances earned his third save, striking out Dustin Pedroia and Xander Bogaerts with runners at the corners to end it.

Luis Cessa (2-0) pitched two scoreless innings. Brad Ziegler (0-3) got the loss.

Boston starter Eduardo Rodriguez gave up one run and three hits in seven innings.

Hanley Ramirez drove in both runs for Boston with a single in the first and an RBI double in the fifth off Michael Pineda.

Ramirez later was knocked down in a collision by Gary Sanchez while trying to field a bounced throw at first base. Ramirez was checked by a trainer and stayed in the game.

FENWAY FAREWELL

Rodriguez was pleased to have the RBI to remember rather than going 0 for 4 in his final game of the AL East rivalry. He said it was a good way to say farewell to Fenway Park, where in 1994 Rodriguez was a teenager with Seattle when he got an infield single at Fenway Park for his first major league hit.

Rodriguez said the Boston fans treated him exactly as he expected them to.

"They're passionate fans. They love their team," he said.

BAT BOY

Rodriguez handed over a bat to a young boy he said he made a deal with in the first inning. The kid would get the bat if Rodriguez homered, got two hits or the Yankees won. It turned out to be Door No. 3.

"That was the deal," Rodriguez said. "Every at-bat he just kept sending me encouraging messages and then he got the bat."

RIGHT PLACE

Ziegler credited the Yankees for the rally in the eighth.

"I felt like I made a couple pretty good pitches. The one Ellsbury hit wasn't even a strike," Ziegler said. "Made a good pitch to A-Rod and got just a little tapper in front of the plate. That's a pitch a lot of times guys swing and miss or if they do hit it they hit it a little harder than that. He just hit in a spot where we couldn't do anything about the guy at third."

TRAINER'S ROOM

Yankees: RHP Nathan Eovaldi had an MRI on his pitching elbow and was evaluated by team physician Dr. Christopher Ahmad. The Yankees did not disclose the results but did say Eovaldi will seek a second opinion. "Until we have that second opinion, we're not going to release anything," Girardi said.

Red Sox: OF Mookie Betts was out of the starting lineup after leaving Wednesday night's game early with tightness in his right calf. Manager John Farrell said Betts' calf was still sore and he needed a night off.

UP NEXT

Yankees: LHP C.C. Sabathia (6-9, 4.18 ERA) starts as the Yankees return to New York for a weekend series against Tampa Bay. RHP Chris Archer (6-15, 4.26) is scheduled to start for the Rays.

Red Sox: LHP David Price (9-8, 4.34) tries again to snap out of a slump when Boston opens a three-game series at home against Arizona. Price has lost his last two decisions and hasn't won since July 10. LHP Patrick Corbin (4-11, 5.37) starts for the Diamondbacks.

(Copyright 2016 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed)

More From New Jersey 101.5 FM