SAN FRANCISCO -- Joe Panik hit a game-tying single off Los Angeles closer Kenley Jansen with one out in the 10th inning and scored on Buster Posey's RBI single, and the San Francisco Giants beat the Dodgers 5-4 on Saturday night.

Adrian Gonzalez homered leading off the 10th to put the Dodgers up 4-3 before the Giants rallied to win with four consecutive hits off Jansen (2-2).

Denard Span started the comeback with a one-out double. Panik singled in Span to tie the game and Brandon Belt followed with a bloop single to right. Posey then lined an 0-1 pitch to left centre and Panik scored easily.

Chris Stratton, the ninth pitcher used by Giants manager Bruce Bochy, retired three batters for his first major league win.

It's San Francisco's sixth walkoff win this season and their second against Los Angeles.

Gonzalez, Justin Turner and Trayce Thompson had two hits apiece for the Dodgers, who lost for the third time in five games.

ROYALS 4, WHITE SOX 1

CHICAGO (AP) -- Cheslor Cuthbert hit a pair of solo home runs, Danny Duffy pitched six shutout innings and Kansas City ended an eight-game losing streak by beating Chicago.

Kendrys Morales also homered as the World Series champion Royals stopped their longest slide since an eight-game skid in May 2013.

The White Sox lost for the 21st time in their last 29 games following back-to-back wins.

Duffy (2-1) struck out 10 and gave up three hits.

Jose Quintana (5-7) also struck out 10 in his career-high sixth straight loss.

DIAMONDBACKS 5, MARLINS 3

PHOENIX (AP) -- Michael Bourn homered to start a four-run sixth inning and Arizona ended Jose Fernandez's streak of eight consecutive victories by beating Miami.

Fernandez (9-3) retired the first 17 batters he faced before giving up five straight hits and lost for the first time since April 23. The four runs were the most Fernandez has allowed in a game since that loss, a 7-2 defeat at San Francisco. He struck out eight with no walks.

Zack Godley (1-0), called up from Triple-A Reno to make the start, gave up two runs on four hits in six innings, with two strikeouts and three walks. Brad Ziegler escaped a ninth-inning jam for his 40th save in a row, 12 of them this year.

CUBS 8, BRAVES 2

ATLANTA (AP) -- Jake Arrieta allowed only four hits in seven strong innings and, backed by four homers, made an impressive return to winning form for Chicago.

Arrieta (10-1) allowed two runs in his answer to his first loss of the season. He also had two hits.

Miguel Montero hit a three-run homer, Kris Bryant hit a two-run shot and Jason Heyward and Anthony Rizzo also hit homers.

Atlanta starter Matt Wisler (2-7) allowed five runs on seven hits, including three homers, in four innings.

RED SOX 15, TWINS 4

MINNEAPOLIS (AP) -- Xander Bogaerts tacked four more hits onto his majors-most total, including a two-run homer as Boston broke away late.

The highest-scoring team in the majors managed to post a season high in runs, with five apiece in the eighth and ninth against league-worst Minnesota.

Bogaerts also doubled, scored four runs and drove in three.

Heath Hembree (3-0) won in relief. The Red Sox took a 5-4 lead in the sixth against Kyle Gibson (0-4).

TIGERS 6, YANKEES 1

NEW YORK (AP) -- Ian Kinsler homered and drove in a career-high five runs, and Justin Verlander finally won in the new Yankee Stadium.

Verlander (6-5) allowed one run in 6 2/3 innings to snap New York's five-game winning streak. He had been 0-4 with a 4.84 ERA in seven starts at this park, which opened in 2009.

Francisco Rodriguez got one out for his 18th straight save conversion.

Kinsler hit a tiebreaking three-run homer in the Detroit fifth and a two-run double in the seventh. Nick Castellanos also homered.

Masahiro Tanaka (3-2) allowed five runs on six hits in 6 1/3 innings.

CARDINALS 5, PIRATES 1

PITTSBURGH (AP) -- Carlos Martinez pitched into the ninth inning for his third consecutive win and Matt Holliday had a three-run homer among his three hits for St. Louis.

The Cardinals won for the sixth time in seven games. Pittsburgh lost its fourth in a row.

Martinez (7-5) gave up one run and six hits in 8 1/3 innings before being lifted when the Pirates put runners on first and second with one out.

Trevor Rosenthal got two outs for his 12th save in 14 opportunities.

Holliday's 10th home run capped a four-run fifth inning against Francisco Liriano (4-6).

BLUE JAYS 11, ORIOLES 6

TORONTO (AP) -- Edwin Encarnacion hit two more homers and drove in five runs for Toronto.

Encarnacion snapped an 0-for-19 slump by ending Friday's game with a leadoff homer in the 10th.

Chris Davis hit a two-run homer for Baltimore and Manny Machado and Joey Rickard each hit solo shots.

J.A. Happ (7-3) went seven innings. T.J. McFarland (1-2) lost in relief.

ASTROS 4, RAYS 3

ST. PETERSBURG, Fla. (AP) -- Carlos Gomez and Luis Valbuena hit solo home runs to back the pitching of Mike Fiers and lead Houston.

Fiers (4-3) wound up with the win when the Astros held on in the ninth. Down by two runs, Tampa Bay loaded the bases with no outs, but scored just once. Will Harris got his second save,

Gomez went deep off Chris Archer (4-8) to tie it in the seventh. Marwin Gonzalez scored on Erasmo Ramirez's wild pitch in the eighth.

Evan Longoria hit his sixth homer in eight games for the Rays.

NATIONALS 8, PHILLIES 0

WASHINGTON (AP) -- Tanner Roark pitched seven sharp innings and made a rare contribution with his bat to help surging Washington.

Stephen Drew and Anthony Rendon had two RBIs apiece for the first-place Nationals, who have won nine of 12.

Roark (5-4) gave up six hits and struck out seven. He's 0 for 22 at the plate this year, but put down a two-strike bunt that keyed a four-run second inning.

Aaron Nola (5-5) allowed four runs and seven hits in 3 2-3 innings, his shortest outing of the season for Philadelphia.

REDS 2, ATHLETICS 1

CINCINNATI (AP) -- Jay Bruce hit a two-run homer off Daniel Mengden, who made his major league debut after a speedy rise through the minors, and Cincinnati sent Oakland to its seventh straight loss.

Oakland has dropped all seven on the road.

The 23-year-old Mengden (0-1) was acquired from Houston last July as part of the deal for Scott Kazmir. The fourth-round draft pick in 2014 started this season in Double-A. He gave up six hits, walked four and struck out five in 5 2/3 innings, throwing 104 pitches.

Dan Straily (4-2) won and Ross Ohlendorf got his second career save and his first of the season.

BREWERS 7, METS 4

MILWAUKEE (AP) -- Ryan Braun hit two home runs, starting pitcher Wily Peralta had another and Milwaukee used five homers to beat New York.

Braun ended an 0-for-15 skid with his long ball in the third inning. Scooter Gennett and Chris Carter also connected to help the Brewers end a six-game losing streak to the Mets.

Peralta (4-7) allowed homers to Curtis Granderson and Asdrubal Cabrera. Jeremy Jeffress got his 17th save.

Logan Verrett (3-4) took the loss.

ROCKIES 5, PADRES 3

DENVER (AP) -- Charlie Blackmon hit a tiebreaking solo homer off the foul pole in the fifth and Tyler Chatwood effectively threw into the seventh for Colorado.

Carlos Gonzalez had a three-run homer in the first and an RBI single in the fifth for the Rockies.

Chatwood (8-4) threw 6 2-3 innings and gave up three runs. Carlos Estevez earned his first career save.

Erik Johnson (0-1) went 4 2-3 innings and gave up five runs in his Padres debut. He was acquired last weekend in a deal that sent James Shields to the Chicago White Sox.