CHICAGO (AP)Joey Bart and David Villar each homered, doubled and drove in two runs, helping the San Francisco Giants top the Chicago Cubs 5-2 on Saturday to end a five-game losing streak.

It’s been a down year for San Francisco, well out of contention in the NL West. But youngsters such as Bart and Villar, both 25, might be providing a glimpse of a brighter future that’s not-so-distant.

”Just trying to get good pitches and put a barrel on them,” said Bart, who singled in the ninth to finish with three hits. ”There’s a lot of stuff out here to get caught up in and you’ve just got to stay focused on what’s going to make you better, and that’s what I’m trying to do.”

Bart has tried to pass that along to Villar, who’s come up with him in the Giants system.

”Him as a player is a real threat to the ball,” Bart said. ”If he turns it on the barrel, it’s going to go. It’s been a blast to watch him.”

Logan Webb (13-8) allowed two runs on six hits over seven innings, while striking out six and walking none.

The 25-year-old right-hander retired 17 of his last 19 hitters, and extended his career highs for wins and innings pitched.

Manager Gabe Kapler gushes about Webb, now in his fourth season.

”Logan Webb’s a star,” Kapler said. ”He’s one of the best pitchers in baseball. He’s got a big personality. He’s got a great smile. He’s charismatic and interesting. There’s a ton to love about Logan Webb.”

And Webb’s soaking in the Giants’ transition to younger players.

”You never really know what’s going to happen” Webb said. ”They could go and sign 15 guys that are not from here, but it’s fun for me to see because I get to see guys get more comfortable, I guess.”

Joc Pederson doubled and singled for the Giants.

John Brebbia tossed a scoreless eighth. Camilo Doval worked around a leadoff single in the ninth for his 21st save.

Ian Happ doubled twice and drove in a run for the Cubs, who lost for the 10th time in 13 games. Alfonso Rivas tripled and singled.

Chicago starter Marcus Stroman (3-7) yielded four runs – all in the second – and seven hits over four innings. He had allowed one run in 12 innings in his previous two starts.

The Cubs took a 1-0 lead in the first on Happ’s RBI double.

Bart’s 11th homer, to deep left-center, capped the Giants’ four-run second. San Francisco scored its first two runs on Villar’s double and Stroman’s balk with runners on first and third.

”I lifted my leg and everyone yelled, `step off,”’ Stroman said. ”So it happens. I was just little too late. I should have just delivered the pitch.”

The Cubs cut it to 4-2 in the bottom half on Rivas’ triple and an error by second baseman Villar on the relay from right field.

Webb settled in after the second and retired 13 straight before Happ doubled off the left-center all with two outs in the sixth.

Villar made it 5-2 with a line solo shot to left in the eighth.

HOMETOWN HALL

The late Buck O’Neil, the first Black coach in the majors when he was added to the Cubs staff in 1962, was among three inductees to the team’s Hall of Fame on Saturday. Former outfielder Jose Cardenal and longtime play-by-play broadcaster Pat Hughes also were inducted.

LEONE WAIVED

The Giants placed RHP Dominic Leone on unconditional release waivers a day after putting him on the 15-day injured list with elbow impingement. Leone was 4-5 with a 4.01 ERA and three saves in 55 games.

TRAINER’S ROOM

Giants: C Austin Wynns was available off the bench after being struck in the head by a pitch from Drew Smyly on Friday and leaving the game. Bart started behind the plate.

Cubs: 2B Nick Madrigal was placed on the 10-day IL with a right groin strain after undergoing an MRI. He left Friday’s game after the third. . INF Patrick Wisdom (left ring finger sprain) was reinstated from the 10-day IL.

UP NEXT

LHP Wade Miley (1-0, 3.13) starts for the Cubs on Sunday night, his second outing after missing three months with a shoulder injury. Kapler said after the game he wasn’t ready to announce a starter.

More AP MLB: https://apnews.com/hub/MLB and https://twitter.com/AP-Sports