BOSTON (AP) -- David Ortiz stood in the on-deck circle as Texas intentionally walked Dustin Pedroia, hoping the move to put runners on first and second with nobody out would result in the Boston slugger grounding into a double play.
Ortiz did not oblige, driving the first pitch he saw for a three-run homer that lifted the Red Sox to a 6-3 victory over the Rangers on Thursday night after trailing by three runs.
It was his 11th career walkoff home run and first in nearly four years.
''They don't like to mess with Papi late in the game. They stopped doing that,'' Ortiz said. ''In that kind of situation, pretty much most of the time it's either a walk or something else happens. I just keep my patience.''
Jonny Gomes led off the ninth with a double to center off left-hander Michael Kirkman (0-2), who then walked Pedroia intentionally with Ortiz watching and waiting. After going 0 for 3 with a walk, Ortiz delivered a shot that landed in an empty Texas bullpen.
Ortiz watched his homer for a few moments before trotting his way toward home where he was met by a swarm of celebrating teammates.
''I think it was a good move. I don't think there was anything wrong with that,'' Ortiz said of the walk to Pedroia. ''It's part of the game. Sometimes it works. Sometimes it doesn't.''
It certainly did not Thursday.
''Apparently he was just sitting on that pitch,'' Kirkman said. ''I thought it was a really good pitch - good movement inside, right where I wanted it. He just got the barrel to it.''
Andrew Bailey (2-0) pitched a scoreless ninth for Boston, which took two of three from Texas.
Jacoby Ellsbury scored the tying run on a fielder's choice in the seventh inning of his first game after sitting out five straight because of a groin injury. Ellsbury had a pair of doubles and two singles. Gomes also had four hits and Pedroia hit a two-run double in the third.
Jeff Baker and Adrian Beltre drove in all of Texas' runs on early homers off of Jon Lester. The Rangers didn't score after Beltre's solo homer in the third and the Rangers' bullpen couldn't hold off Boston down the stretch.
Texas manager Ron Washington said pitching around the right-handed Pedroia for the left-on-left matchup between Kirkman and Ortiz seemed he best option.
''It's not the first left-hander Big Papi got, but that was the right move to make right there,'' Washington said. ''It was the only move to make. I can live with Papi doing that.''
Texas led 3-2 until Ellsbury scored in the seventh when Mike Napoli beat out the throw on a grounder that would have ended the inning after Boston loaded the bases with one out. Napoli hit a sharp grounder to first baseman Lance Berkman, who bounced his throw to Elvis Andrus covering second.
''We had a couple of opportunities and we were finally able to cash in,'' Boston manager John Farrell said.
Jon Lester survived a rocky first few innings and pitched through the sixth for Boston, leaving with the Red Sox trailing 3-2 on Baker's two-run homer in the second and a solo shot by Beltre in the third. Lester also had to get himself out of trouble in the first by striking out Nelson Cruz after a two-out walk to Berkman and a single by Beltre.
Boston got two back with two outs in the third when Pedroia doubled off the center field wall after Jose Iglesias reached on a walk and Ellsbury singled.
Lester allowed three runs on seven hits, walked three and struck out four.
Texas starter Derek Holland's line was nearly identical. He allowed two runs on nine hits, also walking three and striking out four. Holland was 5-0 against Boston entering the game.
NOTES: Ortiz last hit a walkoff homer against the White Sox on Aug. 26, 2009. ... The Rangers placed 1B Mitch Moreland on the 15-day disabled list Thursday with a strained right hamstring and called up 1B Chris McGuinness from Triple-A Round Rock. ... Lester was making his 200th career start, the third LHP in Red Sox history to reach the mark. ... The Rangers had already clinched the season series against Boston for the fifth straight year with a 3-2 win Wednesday. ... Baker's homer in the second was his fourth in the last nine games. ... Iglesias' single in the sixth increased his hitting streak to 10 straight games. ... Ellsbury had been out since setting a club record with five stolen bases last week in a victory over Philadelphia.