SAN FRANCISCO — The Cubs wanted Aroldis Chapman to be the final piece of a bullpen that could compete in the postseason when they got him from the Yankees in July.

So when he blew a save in the eighth inning of the Cubs Game 3 loss in the NLDS, it would have been reasonable to wonder if his confidence was shaken.

Apparently not.

Chapman struck out all three batters he faced in the ninth inning of Tuesday’s 6-5 comeback win in Game 4 for his third save of the series.

“I wasn’t with this team the whole season, but I’m just trying to get us to where we want to go,” Chapman said through a translator. “We need eight more wins. I understand how much it means to this city, to Chicago. It’s a difficult task, but I plan on getting it done.”

That was not the case in Monday’s loss, when Maddon asked him to get six outs and instead Chapman surrendered a game-tying, two-run triple to Conor Gillaspie and didn’t survive the inning.

“He was so focused,” Maddon said of Chapman’s attitude during Tuesday’s victory. “He was not going to be denied. He did not like what happened [Monday] night. He was outstanding.”

Chapman agreed with his manager’s assessment.

“It was a very bad day for me [Monday], but I forgot about it before this game started,” Chapman said. “I knew what I had to do today. I had to get this win.”

And now he will head to the NLCS, trying to help the Cubs get to the World Series less than a year from his trade to the Yankees — a year that also included a suspension for violating MLB’s domestic violence protocol.

“I never thought I would leave the Reds, but they traded me to a team with a large history like the Yankees,” Chapman said. “And then I got traded to another team with a long history, but one where they haven’t won. I want to get this championship to Chicago.”