ANAHEIM, California — Leadership often demands actions more often than words, as Dustin Pedroia demonstrated Sunday.

Pedroia hit a three-run home run and Xander Bogaerts followed with a solo blast to lead a five-run rally in the ninth inning that gave the Boston Red Sox a 5-3 win over the Los Angeles Angels in front of 39,553 at Angel Stadium.

“I don’t think anybody expected him to do that more than him,” right-hander Clay Buchholz said about Pedroia. “He’s one of the leaders on this team. He sees the ball well and if he gets a good pitch and barrels it up, he can go out of any ballpark in any direction.”

The Red Sox used the win to close within 1 1/2 games of the American League East-leading Baltimore Orioles.

“Hopefully, that’s the start of something,” Boston manager John Farrell said about the victory, just the team’s second in its past seven games.

Buchholz earned the win with three hitless innings of relief. Buchholz (4-9) permitted just one baserunner on a walk and collected one strikeout. Brad Ziegler received his second save.

“I’ve been able to work on arm slot and arm angle,” said Buchholz, a former starter who moved to the bullpen in May. “That’s been making my pitches have a little more depth. I’m not necessarily having to nibble at the plate. I’m able to throw cutters on the plate for strike one and then let the fastball, curveball and changeup work.”

Angels left-hander Tyler Skaggs made his second start since returning from Tommy John surgery, tossing 5 1/3 shutout innings, Skaggs amassed eight strikeouts with a fastball that reached 95 mph, allowed four hits, scattered two walks and threw 97 pitches. Skaggs made his season debut on Tuesday night after two years of recuperation.

“Tyler pitched a terrific game,” Angels manager Mike Scioscia said. “We knew he had to work hard for his outs, and he did. He used all of his pitches and he had good life on his fastball.”

Boston designated hitter David Ortiz, who was playing his final game in Anaheim, received standing ovations before his first and fourth plate appearances from the large contingent of Red Sox fans. Supporters chanted “Papi, Papi” during his at-bat in the eighth inning, and gave him another standing ovation after he struck out, when Los Angeles held a 3-0 lead.

The Angels needed one strike to complete the shutout when the Red Sox erupted for five runs in the top of the ninth against closer Huston Street (3-2). Jackie Bradley Jr. began the inning with a walk and Aaron Hill followed with a single before Street struck out Ryan Hanigan and Brock Holt.

Then on a 2-2 pitch, Mookie Betts hit a single to right field to bring home Bradley. Pedroia then hit his 12th home run of the year, a three-run drive over the center-field fence that gave the Red Sox their first lead of the game. Center fielder Mike Trout grabbed the top of the fence but had no chance to make the catch.

“I faced him the other night and his ball was moving away late,” Pedroia said about Street. “I just wanted to let the ball travel. Hopefully, it would come back closer to me. I got a pitch to hit and I hit it good.”

Bogaerts, the next hitter, added his 14th homer to left-center field to chase Street and complete the rally.

Los Angeles brought the potential tying run to the plate in the bottom of the ninth when Yunel Escobar singled for this third hit. But Ziegler induced Kole Calhoun to hit into a double play to ensure the victory.

The Angels combined four hits and a walk to score three runs in the fifth inning. With one out, Escobar singled between right-hander Steven Wright’s legs and Calhoun followed with a looping single between shortstop Bogaerts and center fielder Bradley to send Escobar to third base.

Trout drove in Escobar by lining a single off the glove of a leaping Bogaerts. Calhoun took third on the play and scored when Albert Pujols grounded out, with Trout moving to second. After Andrelton Simmons walked, Jefry Marte blooped another single into center field to bring Trout home.

Los Angeles had a chance to move ahead in the first inning but two unusual plays thwarted the club.

With Escobar at second base and Calhoun at first, Trout singled past a diving Bogaerts into left field. Left fielder Bryce Brentz tried to throw out Escobar at the plate but catcher Hanigan dropped the ball. However, Escobar fell awkwardly while trying to avoid the potential tag and failed to touch the plate. Wright recovered the loose ball and tagged Escobar out.

“We felt the ball beat him but he tried to cut in to avoid the tag,” Scioscia said about Escobar. “When Hanigan dropped the ball, he was too far in and never got to the plate.”

Pujols then dumped a single into short right field to load the bases. Simmons followed by striking out on a pitch that eluded Hanigan. Calhoun tried to score on the play but Hanigan retrieved the ball and threw to Wright, who tagged Calhoun to complete the double play.

“There were a couple of heads-up plays by Steven Wright,” Farrell said. “We certainly escaped quite a bit of damage in the first inning.”