BOSTON (AP) The Boston Red Sox were in danger of capping an awful month-long stretch by being swept in four games by the similarly struggling Chicago White Sox.
Then they called on Craig Kimbrel to shut things down.
Pitching two full innings for the first time in more than five years, the Red Sox closer got out of a bases-loaded jam with nobody out in the 10th, and Xander Bogaerts delivered the winning single in the bottom half to give Boston an 8-7 victory over Chicago on Thursday.
''We're staring at a four-game sweep at home, and that's never a good thing,'' manager John Farrell said. ''So you find a way to pull out all the stops. ... You do what you can with what you have in the moment.''
Chicago led 3-0, 4-1 and 7-5 before Boston sent it into extra innings with a run in the seventh and another in the eighth.
The White Sox loaded the bases with nobody out in the 10th, but Kimbrel (1-3) got J.B. Shuck on an infield popup and then struck out Tim Anderson and Adam Eaton.
''We had some golden opportunities,'' White Sox manager Robin Ventura said. ''We just couldn't hold them. We were walking some people, letting them have some good opportunities. We got ourselves into some good opportunities and they got out of them.''
In the bottom half, Matt Purke (0-1) walked two before Bogaerts lined one up the middle and Mookie Betts scored easily from second.
In all, Kimbrel allowed one hit and walked two while striking out three in two innings for his first American League win.
''He shut it down,'' Bogaerts said. ''I mean, that's how nasty he is. He's pretty filthy, one of the best closers in the game. And obviously that's what we all expect from him.''
James Shields pitched his best outing in four starts since being acquired by the White Sox on June 4. Jose Abreu hit a three-run homer and Alex Avila had four hits for Chicago, which has lost 27 of its last 40 games.
Betts, Bogaerts, Dustin Pedroia and Hanley Ramirez had two hits apiece for the Red Sox, who improved to 11-15 in their last 26 games. Boston's leadoff hitter reached safely seven times in 10 innings.
David Ortiz walked three times and led off the ninth with a double that one-hopped the short wall behind the Pesky Pole. Travis Shaw was walked on four pitches, but Jackie Bradley Jr. struck out, Ramirez lined out and Sandy Leon struck out to end the inning.
Kimbrel, who came on to start the ninth, walked Brett Lawrie and gave up Avila's single. Avisail Garcia walked before the Red Sox closer retired the next three batters to protect the tie.
The White Sox led 4-1 before Boston scored four in the sixth to take a 5-4 lead. Then Junichi Tazawa relieved Tommy Layne with two men on in the seventh and gave up Abreu's three-run homer over the Green Monster that made it 7-5.
The Red Sox tied it to send it into extra innings, loading the bases in the seventh before pinch-hitter Shaw launched a long sacrifice fly. Bradley popped up a bunt, and Ramirez struck out to end the inning.
In the eighth, Marco Hernandez hit his first career double and scored on Pedroia's single to tie it 7-all.
BIG GAME, JAMES
After struggling in his first three starts for Chicago, getting just five outs against Cleveland on Saturday, Shields recorded his first scoreless first inning since joining the White Sox. He cruised into the sixth before walking the first two batters.
''My first three outings weren't very good,'' he said. ''So it's definitely positive. But I've been around the game a while, I've got a lot more in the tank, my body feels great, so we'll move forward. ... Coming in here to Boston, one of the best teams, best hitting teams in the league, and to do what we did, three out of four, is pretty good.''
Red Sox: Outfielder Chris Young pulled up grabbing his right leg after rounding first base on a ball hit off the Green Monster in the second inning. He was helped off the field with what the team said was a hamstring injury. He was placed on the disabled list after the game.
White Sox: Open a three-game series at Toronto. Carlos Rodon will pitch against Aaron Sanchez.
Red Sox: Open a three-game series at Texas. David Price will face Nick Martinez.