OAKLAND, Calif. - David Ortiz saved his only hit for a key moment for the Boston Red Sox.

Ortiz connected for a leadoff home run in the 10th inning, and the Red Sox beat the Oakland Athletics 7-6 on Sunday to avoid a four-game series sweep.

"I like to go out there and make things happen," Ortiz said. "We've had a good game, had a good series and then we go back to struggles. So hopefully everything changes at some point."

Ortiz was the only Boston starter without a hit until he lined a 1-2 pitch from Fernando Abad (2-3) over the wall in left-centre for his 17th homer.

The Red Sox had to go extra innings after letting a 6-1 lead slip away. The A's scored three runs in the eighth, and then homered twice in the ninth against Koji Uehara (3-1). The closer had converted 31 consecutive save opportunities dating to 2013.

"I'm getting hit on day games," Uehara said through an interpreter. "I think it's because I'm old. I'm not woken up."

The Red Sox pulled within 6 1/2 games of first-place Toronto in the AL East. New York and Baltimore are 1 1/2 games back.

Ortiz's homer came four days after the designated hitter belted a tying drive in the 10th inning of a 2-1 victory against Minnesota.

"He does have the knack for the moment," Boston manager John Farrell said. "More than anything he stays at rest or at peace mentally in those key spots and doesn't miss his pitch when he gets it."

Mike Napoli and David Ross also homered for Boston, which had been limited to two runs or fewer in eight consecutive games. Napoli scored another run as part of a double steal, and former A's player Jonny Gomes added a two-run single.

Oakland's late surge negated a strong outing by Boston starter Jon Lester.

Lester, who had a career-high 15 strikeouts against the A's earlier this season, allowed two earned runs and four hits over 7 2-3 innings. He struck out four and walked two.

The veteran left-hander left after hitting Craig Gentry and walking Jed Lowrie with two outs in the eighth.

Burke Badenhop came in and gave up three consecutive RBI singles to make it 6-4 before Andrew Miller got pinch-hitter Coco Crisp to line out to shortstop.

Uehara, who had the longest successful save streak in the majors, blew a shot at extending his impressive run when he yielded home runs by Stephen Vogt and pinch-hitter John Jaso.

"That's a good example of the kind of grit and determination this team has," said Oakland closer Sean Doolittle, who grounded out to second as a pinch hitter in the 10th. "Night after night it seems like it's only a matter of time before our offence finds a way to come through and push some runs across."

Oakland catcher Derek Norris had to leave the game in the 10th after a frightening situation when he was hit in the back of the head by Gomes' bat on a follow-through swing. Norris immediately dropped to the ground as home plate Greg Gibson quickly called for A's trainers.

Norris was eventually helped to his feet and walked to the dugout. He was taken to a hospital as precaution and was scheduled to undergo a CAT scan.

Boston broke out of its week-long scoring slump and got to Tommy Milone after loading the bases with two outs in the first on two singles and a walk. Gomes' two-run single put the Red Sox up 2-0.

Ross, who homered off Milone earlier this season at Fenway Park, did it again on the first pitch in the second.

NOTES: Oakland's last four-game sweep of Boston came in 1971 at Fenway Park. ... Oakland 1B Kyle Blanks left after getting thrown out at home in the second. Blanks has been nursing a calf strain and aggravated it while sliding into home plate. ... With two days off in the next week, the A's plan to skip Sonny Gray's turn in the rotation. Gray, who has yet to pitch a full season in the majors, has already logged a team-leading 99 innings. ... Boston OF Shane Victorino (right hamstring strain) took batting practice with Triple-A Pawtucket but did not play. .. Red Sox RHP John Lackey (8-4) pitches the series opener against Seattle on Monday. ... It was Oakland's eighth sellout of the season.