SAN DIEGO — Travis Shaw, Hanley Ramirez and Brock Holt homered and David Price threw seven solid innings to lead Boston past the San Diego Padres 7-2 on Wednesday night, moving the Red Sox into first place in the AL East.

Shaw, inserted into the lineup for a slumping Yoan Moncada, hit his 16th homer in the second inning, a two-run shot, and added an RBI single in the fourth.

Ramirez’s homer came in the eighth off Jake Smith’s first major league pitch.

Holt added a pinch-hit homer in the ninth

The Red Sox took a one-game lead over the Toronto Blue Jays, who lost 2-0 to the New York Yankees. Boston, which completed interleague play with a 14-6 record, opens a three-game series in Toronto on Friday.

Price (15-8) won his season-high sixth straight start, allowing two runs and six hits. Price, who has won four of his last five road starts, struck out eight.

Three relievers finished off the Padres, with Craig Kimbrel getting the final out.

Jarred Cosart (0-3) left after 31/3 innings after hurting his right leg while covering first base on Jackie Bradley Jr.’s grounder. Cosart landed awkwardly after reaching for Wil Myers’ erratic throw that drew an error and led to the Red Sox rally. Cosart strained his right hamstring and groin.

Boston’s three-run fourth inning was the difference. After Shaw’s RBI, Dustin Pedroia drove in Shaw and Chris Young with a double down the left-field line.

Myers’ sacrifice fly tied the game 2-2 in the third. Cosart came around after opening the inning with a single.

The Red Sox went ahead 2-1 when Shaw crushed Cosart’s 93 mph fastball 425 feet for a two-run homer. Shaw replaced Moncada, a prized Cuban prospect, at third base after Moncada struck out seven straight times.

Yangervis Solarte’s RBI double in the first scored Myers for a 1-0 lead. Myers had reached on a single.

NOTES: RHP Steve Wright (bursitis right shoulder) remains out and Manager John Farrell said he doesn’t know an end date to the injury.