First-year San Francisco manager Gabe Kapler had to use five pitchers to keep his club on a roll and got another big night from the offense.
"We have guys that can hit the ball out of this ballpark, out of other ballparks," Kapler said. "One of the things that we continue to say and that we've seen play out is that we're not out of games so we can handle an early deficit and trust that we have the guys who can hit singles but also hit balls in the gaps and sometimes in the seats."
J.P. Crawford drove in three for the Mariners.
Ruf's blast off lefty reliever Anthony Misiewicz (0-2) was his third of the season and the fourth of his career as a pinch-hitter. Ruf, in his first year back in the majors after playing three seasons in Korea, was called on to hit for Dickerson, who homered off right-hander Brady Lail in the third.
"It's a lot of fun mainly because most of the time it's not going to work out that way where you're going to get a home run from the left side and then Ruf's going to come in and pinch hit and hit a big home run," Kapler said. "That just doesn't happen that frequently, so when it does work out in your favor you remember how often it goes the other way."
Dickerson, who was questionable before the game after fouling a ball hard off his right knee on Monday, praised Kapler for the move.
"That was awesome," Dickerson said. "To make a move and the guy immediately does the best thing you can do and hits a home run . it was awesome production."
Dubon also homered off Lail.
Seattle manager Scott Servais was ejected in the eighth inning by home plate umpire John Libka for arguing balls and strikes.
"The first one was definitely low and the second one was lower than that," Servais said. "Got to be better."
Giants starter Logan Webb allowed five runs and six hits in five innings.
Mariners starter Ljay Newsome was knocked out of the game after getting hit near the wrist on his pitching hand by a 100 mph line drive from Brandon Crawford leading off the second. The ball ricocheted off Newsome's hand high into the air and was caught by Crawford at shortstop for an out. Newsome grimaced and repeatedly tried to flex his hand before Servais and a team trainer came out.
"Actually feels pretty good right now. I have full motion in it," Newsome said. "I've been hit plenty of times but I've never come out of a game."
The Giants recalled OF Luis Basabe from the alternate training site in Sacramento and optioned IF Daniel Robertson down.
Mariners: Newsome underwent X-rays which were negative. He is day to day.
Giants: Pablo Sandoval was at third base for another game as regular starter Evan Longoria deals with soreness in his right glute. Longoria entered the game as a defensive replacement in the ninth. ... RHP Jeff Samardzija (inflamed throwing shoulder) will throw a simulated game Thursday at the team's Sacramento alternate site. ... LHP Drew Smyly, sidelined by a sprained index finger on his pitching hand, is still expected to be activated in the next couple of days.
Seattle's Nick Margevicius (1-2, 3.86) and San Francisco's Tyler Anderson (1-3, 5.18) pitch the series finale in a matchup of lefties Wednesday. Margevicius will make his fifth start after beginning the season in the bullpen. Anderson's last three starts all came against Arizona.
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports
The MLB teams with the most serious work still to do this offseason
The Mets did their work by adding Francisco Lindor. Now, the spotlight moves to those who have big holes to fill. Enter the Twins, Phillies, Blue Jays and Red Sox.
Former Oakland Athletics pitcher Dave Stewart bids $115 million on share of Oakland Coliseum
Former Athletics pitcher Dave Stewart submitted a bid to buy a share of the Oakland Coliseum with plans to develop the site should the A's leave the ballpark.
Tri-City ValleyCats suing Major League Baseball, Houston Astros
The Tri-City ValleyCats, who operated as a short-season affiliate of the Houston Astros for 18 seasons before being dropped, have filed a lawsuit against Major League Baseball and the Astros.
LHP Martin Perez returns to Boston Red Sox on one-year deal, source says
Veteran starter Martin Perez has agreed to a one-year, $5 million guaranteed contract to return to the Boston Red Sox, a source confirmed to ESPN's Jeff Passan.
Baltimore Orioles reach one-year deal with recovering Trey Mancini
— The Baltimore Orioles agreed to a $4.75 million, one-year deal with recovering slugger Trey Mancini on Friday but haven't come to terms yet with outfielder Anthony Santander.
New York Yankees roll dice on Corey Kluber: Will he return to Cy Young form?
If the longtime ace bounces back from two injury-plagued seasons, New York might have just reeled in one of the biggest fish of this offseason.