SAN FRANCISCO — Joe Panik highlighted an 18-hit attack with two home runs Sunday afternoon, leading the San Francisco Giants to a 13-4 shellacking of the Atlanta Braves.

Madison Bumgarner benefited from the Giants’ highest scoring game in more than two months, helping San Francisco post just its second series win since the All-Star break.

The win also allowed the Giants to take the season series from the Braves after the clubs split the first six games.

Panik hit a solo homer in a two-run second inning that allowed the Giants to overcome an early 1-0 deficit, then added a two-run shot in the fourth to get the San Francisco offense into high gear.

The home runs were the ninth and 10th of the season for Panik, who had his first multiple-homer game of the season. He later had a single and a sacrifice fly to finish with three hits and four RBIs.

Denard Span had a second Giants homer in the fourth inning off Braves starter Aaron Blair, and San Francisco piled it on with an eight-run eighth against the Atlanta bullpen.

Eduardo Nunez had a solo homer and three Giants — Brandon Crawford, Jarrett Parker and pinch-hitter Conor Gillaspie — smacked triples in the seven-hit, eighth-inning explosion.

The 13-run total was the Giants’ most since a 15-4 win at Pittsburgh on June 21.

Bumgarner (13-8) won for the third time in his last four starts, allowing three runs and five hits in seven innings. He walked two and struck out five.

The All-Star left-hander has gone 7-0 in his last eight starts against the Braves.

Blair (0-6), called up from Triple-A Gwinett to make the start, allowed five runs and eight hits in four innings.

Crawford and Eduardo Nunez joined Panik with three hits apiece for the Giants, who had been held to five hits in a 3-1 loss to the Braves on Saturday night.

Span, Parker and Brandon Belt added two hits each for San Francisco, which had 10 extra-bats hits — four homers, four triples and two doubles.

The Giants also played their 13th consecutive error-free game.

Freddie Freeman hit a two-run homer and Ender Inciarte had a double and a triple for the Braves, who had five extra-base hits among their six total hits.

Freeman’s homer was his 27th of the season and seventh in his 21 career games at AT&T Park.

Gordon Beckham added a solo shot with two outs in the ninth, his fifth home run of the season, to cap the scoring.

The homers gave the Braves 65 in their last 66 games.

The game had gotten off to a promising start for the Braves when Inciarte tripled leading off the first. It was just the second triple that Bumgarner ever allowed to the first batter of the game, and his fourth ever to a left-handed hitter.

Matt Kemp’s sacrifice fly gave Atlanta a brief 1-0 lead.

The loss capped a 3-4 trip for the Braves, who haven’t had a winning trip longer than five games this season.

NOTES: In order to create a roster spot for RHP Aaron Blair, the Braves optioned RHP John Gant to Triple-A Gwinett before Sunday’s game. … The Giants also made a roster move before the game, placing RHP Derek Law (strained right elbow) on the 15-day disabled list and promoting OF Jarrett Parker from Triple-A Sacramento. … Giants manager Bruce Bochy said he has not decided who will pitch in the No. 5 spot in the rotation moving forward. He said his options will increase once rosters expand to 40 players on Thursday. … Both teams have Monday off.