BOSTON – Jonny Gomes knew he’d have another chance at the same pitch after looking bad on a pair of sliders. He didn’t miss the next time.

Gomes hit a pinch-hit homer leading off the ninth inning to lift the Boston Red Sox to a 2-1 win over the suddenly offensively challenged San Diego Padres on Wednesday night.

Gomes lined a 2-2 pitch off Luke Gregerson (4-4) into the first row of seats above the Green Monster for his second game-ending homer of the season.

“That guy throws good sliders like he did the inning before and he did to me,” said Gomes, who swung and missed badly on two that sailed away. “The first three pitches no one was going to hit them. I let one go and then kind of set my sights on getting one up, and got good wood on it.”

Gomes rounded third after his winning shot, took his helmet off, held it like a fullback going into the line of scrimmage and was mobbed by his teammates at home plate.

“The clubhouse stuff has been talked about more than his play on the field, but he’s been great for us,” Boston starting pitcher Jon Lester said of the easygoing Gomes.

“I just had three swings tonight,” Gomes said, standing in the middle of the clubhouse wearing red, white and blue shorts. “Those guys did a lot of work. Whether it’s me or someone else, winning’s fun. It’s contagious.”

Mike Carp had two hits and scored a run for Boston, which is 7-1 on its nine-game home stand that concludes Thursday against the Padres.

“When we get into some of these National League teams, we don’t have a lot of history against their guys coming out of the bullpen,” Boston Manager John Farrell said of the move. “In this case, Gomes had faced Gregerson twice and also hit a walk-off against him previous.”

Koji Uehara (2-0) pitched one inning for the win.

The Red Sox squandered a good chance in the eighth. Dustin Pedroia led off with a double off the Monster against Nick Vincent. After David Ortiz was intentionally walked for the second time, Gregerson relieved and retired the next three batters, striking out Daniel Nava and Jarrod Saltalamacchia.

San Diego starter Edinson Volquez pitched six innings on his 30th birthday, giving up one run on seven hits, striking out six with one intentional walk.

“When we lose a game like that, there’s nothing we can do,” he said. “We battled the whole game. We lost in the ninth. Can’t happen. We’ve got to come back tomorrow and win the next game.”

Lester had a similar line over seven, allowing six hits, one run, walking one and striking out five. He entered 2-4 with a 6.98 ERA in his last eight starts.

Lester labored in the first, throwing 32 pitches and giving up a run. Plate umpire Doug Eddings called time just as Lester was starting to throw a pitch to Chase Headley. It hit him on the foot, but was waved off. Headley then proceeded to have a 10-pitch at-bat, reaching on a single. Kyle Blanks followed with an RBI single to center.

Boston tied it 1-1 when Carp singled leading off the fourth and scored when left fielder Quentin misplayed a carom off the Green Monster on Saltalamacchia’s double.

Lester settled down after the first, retiring the Padres in order on just five pitches in the second. He gave up a hit, but needed only 12 in the third.

Both dugouts were warned by Eddings after Volquez hit Jose Iglesias with the first pitch in the third inning.