SAN DIEGO — Three hours before first pitch on Tuesday at Petco Park, Padres starts Manny Machado and Fernando Tatís Jr. stood side-by-side in front of a group of reporters and pledged to clean up San Diego’s mess.

A trendy favorite to contend for a World Series back in spring training, the Padres opened this week’s series against the Giants trailing San Francisco by 20.5 games in the National League West.

Machado smashed two home runs and Tatís delivered a pair of hits including a RBI single, but the Padres’ $300 million men were no match for “Late-Game LaMonte.”

With the Giants and Padres tied 5-5 in the ninth inning, Giants right fielder LaMonte Wade Jr. played the role of hero yet again with a bloop single into left field to drive in Brandon Belt from second and lead San Francisco to a 6-5 come-from-behind win.

Wade entered his at-bat against Padres closer Mark Melancon 11-for-18 in the ninth inning this season and put just enough backspin behind a 64.8-mile per hour popup to clear the head of Tatís in shallow left field and bring home Belt.

“I would much rather have these at-bats early in the game or throughout the game,” Wade said. “But I guess it’s not a bad thing that they come late.”

Wade has endeared himself to Giants fans this season by contributing to late rallies against the Dodgers, Diamondbacks and A’s and he checked another team off the list on Tuesday with an impressive two-strike approach against Melancon.

“LaMonte was in battle-mode,” manager Gabe Kapler said. “He’s been so big in those situations and got a ball he was able to fight off and kept us alive and put us in a good position.”

The RBI single marked the fifth time Wade has either tied a game or given the Giants the lead in the ninth inning of a road game since the All-Star break. Tuesday’s hit preceded a tense ninth inning for closer Tyler Rogers, who helped the Giants secure their 98th win of the season on a night the Padres took an early three-run lead.

Belt’s aggressive decision to race toward third base on Wade’s single allowed him to score the game-winning run, but he made an equally critical play to help Rogers in the bottom of the frame when he stopped a 112.2 mile-per hour shot off Machado’s bat and started a game-ending 3-6-1 double play that featured a perfect exchange and throw from shortstop Brandon Crawford.

“The Brandons play such good defense and at such a fast pace,” Rogers said. “I was just happy to be a part of it.”

Machado’s laser was the fourth ball he struck extraordinarily hard on Tuesday as he hit both of his homers off Giants starter Kevin Gausman while also watching a 106.1-mile per hour flyball fall into Mike Yastrzemski’s glove at the right center field warning track in the seventh inning.

For the second time in as many weeks, Giants leadoff hitter Tommy La Stella gave his club a first-inning lead against the Padres as he sent a slider from Joe Musgrove over the right field wall for his sixth home run of the season. The Giants’ offense appeared poised to add on behind La Stella, but Crawford lined a hard-hit ball just outside the right field foul line before grounding into a 4-6-3 double play with the bases loaded and one out.

It took until the fifth inning for the Giants to score again against Musgrove, but pinch-hitter Wilmer Flores and catcher Buster Posey ignited a comeback effort with a RBI single and a sacrifice fly. The Padres tried to squeeze a sixth inning out of their starter, but the move backfired when Kris Bryant and Crawford hit back-to-back doubles to knot the game at 4-4.

Following a Yastrzemski sacrifice fly, the Giants took a 5-4 lead, but they wouldn’t hold it for long as Padres catcher Austin Nola greeted reliever Zack Littell by hitting a game-tying home run into the left field seats to start the bottom of the sixth.

Nola’s solo shot was the fourth of the night for San Diego, which highlighted the early trouble Gausman faced.

In 42 career appearances with the Giants entering Tuesday’s start, Gausman had surrendered just two home runs on splitters as the offering has been one of the most dominant pitches in the majors over the last two seasons. Through the second half of this season, however, Gausman has struggled to locate his splitter and the issue haunted him against the Padres.

Machado, Gausman’s former teammate with the Baltimore Orioles, launched loud home runs in each of his first two at-bats against splitters that were left right over the heart of the plate. The third baseman’s first home run was a mammoth game-tying solo shot that caromed off the railing of the third deck of the Western Metal Supply Co. building beyond the left field fence.

Machado’s next homer gave the Padres a 3-1 lead as he sent another hanging splitter into the second deck of seats in front of the same brick building.

“I was just really inconsistent with it tonight,” Gausman said of his splitter. “Every pitch I threw that was up in the zone, they didn’t miss it. They were all over it. Pretty frustrating. Obviously a big game tonight and I just didn’t pitch very well.”

Two batters later, Tommy Pham crushed another splitter from Gausman into the left field bleachers to push the Padres ahead 4-1. Pham’s homer put all of the momentum on the Padres’ side on Tuesday, but in the end, the Giants had “Late-game LaMonte” on theirs and that’s what mattered.