Two teams racing backward in their pursuit of the National League West-leading Los Angeles Dodgers open what could be a pivotal four-game series.

It’s the Giants and Padres in San Diego on Thursday night — and both teams are struggling.

The Giants flew to San Diego late Thursday night after rallying from a 4-0 deficit to score a 7-5 win in Arizona, ending a six-game losing streak. San Francisco is 4-12 over its past 16 games.

The Padres were just swept at home by Seattle in a two-game, interleague series. Beyond that, San Diego has lost five of its past six games and eight of its past 10. Another alarming statistic — the Padres are just 21-18 at home this season.

Padres manager Bob Melvin thinks his club might be pressing.

The Padres have scored more than four runs in a game only twice in the past 12 games. They scored two runs in each of the losses against the Mariners and are 5-for-41 over the past five games with runners in scoring position.

“I think it gets to a point where you do (press) a little bit,” Melvin said after Tuesday’s loss. “You don’t want to say that. You keep saying, ‘If we get opportunities, we get guys on, we’re going to break through.’ That has happened before … it just hasn’t happened during this stretch.”

Giants manager Gabe Kapler said the Giants could turn their slide around quickly, with possibly Wednesday’s night’s come-from-behind win being the spark.

“We have a lot of work to do,” Kapler said before Wednesday’s win. “We recognize we’re not playing our best baseball. Things have a chance to turn quickly, but this has been a very rough stretch. I don’t think we’re playing good baseball. If we play good baseball, we win series.”

The Padres’ slump has dropped them six games behind the Dodgers. The Giants are 10 1/2 games back and had they lost Wednesday, they would have fallen to .500 on the season.

This will be the third meeting of the season between the teams, and the Padres hold a 4-2 edge after sweeping a three-game series in San Francisco in May.

The series opens Thursday night with a match of tough right-handers — Logan Webb (7-3, 3.13 ERA) starting for the Giants against the Padres’ Joe Musgrove (8-2, 2.25).

Webb is 2-2 over his past four starts, giving up seven runs (four earned) on 19 hits and six walks, with 27 strikeouts over 26 innings for a 1.38 ERA. He made one start against the Padres this season and held San Diego to one run on four hits, with seven strikeouts, over eight innings to pick up the win on April 13.

The 25-year-old is 2-1 lifetime against the Padres with a 3.60 ERA. The Padres are batting .260 against him in seven games (six starts).

Musgrove has faced the Giants once this year, giving up four hits, three walks, with four strikeouts over seven shutout innings on May 21 in San Francisco.

Musgrove is 3-3 lifetime against the Giants with a 4.23 ERA and a .254 opponents’ batting average in eight starts. Musgrove is 1-2 over his past three starts with a 4.95 ERA.

–Field Level Media