Francisco Liriano pitched four-hit ball into the eighth inning Saturday, and the Pittsburgh Pirates beat the playoff-bound Chicago Cubs 4-0 for their eighth straight victory.

Liriano (12-7) struck out nine and walked three over 7 2/3 innings. Jordy Mercer had a three-run homer off Jason Hammel (9-7), and the Pirates continued to roll.

They lead Chicago by 5 1/2 games for the top wild card with a chance to complete a weekend sweep on Sunday. The Pirates then open a three-game series Monday against St. Louis, the team they trailed by three games for the NL Central lead when the day began.

More from FoxSports

Despite the loss, the Cubs had plenty to celebrate Saturday. They secured their first playoff appearance since 2008 Friday night when Oakland beat San Francisco, after enduring five consecutive losing seasons and a major overhaul under president of baseball operations Theo Epstein and general manager Jed Hoyer.

Fans cheered a pregame video tribute and players tipped their caps. But things did not go so well after that.

Liriano improved to 8-1 in his last 16 starts -- all but one of them wins for the Pirates.

He left with runners on first and second after walking Kris Bryant with two outs in the eighth. Antonio Bastardo then retired Anthony Rizzo on a flyball.

Hammel allowed three runs and seven hits over four-plus innings. He exited after giving up five consecutive hits to start the fifth, and the Pirates sent nine batters to the plate in the inning.

The big blow was Mercer's three-run drive to left -- his third homer -- after Francisco Cervelli and Pedro Alvarez opened it with singles. Two more singles by Liriano and Starling Marte chased Hammel, but Pittsburgh wasted a big opportunity to add to the lead.

Justin Grimm walked Andrew McCutchen with one out to load the bases. Trevor Cahill then retired Aramis Ramirez on a shallow fly to right and struck out Neil Walker, who tossed his bat after missing a 3-2 pitch.

Sean Rodriguez added an RBI double off Tommy Hunter in the eighth, making it 4-0.

TRAINER'S ROOM

Pirates: RF Gregory Polanco was held out of the lineup. He had been bothered lately by a knee problem, although manager Clint Hurdle indicated it was just a day of rest.

UP NEXT

Pirates: A.J. Burnett (9-5, 3.15 ERA) looks to build on a win over Colorado as the Pirates wrap up their three-game series against Chicago.

Cubs: Tops in the majors in wins, Jake Arrieta (20-6, 1.88) tries to become the first Cubs pitcher with more than 20 since Fergie Jenkins went 24-13 in 1971.