Chicago — When it was over, Anthony Rizzo jumped around Wrigley Field and hugged everyone in sight. The moment was in his grasp, and he was determined to hold onto it for as long as possible.

The All-Star slugger endured several seasons of losing with the Cubs before they finally got into the playoffs again, and he was more than ready to enjoy the franchise’s first appearance in the National league Championship Series in more than a decade.

“Obviously times weren’t easy the last few years, but with all the talent we had and all the talent we were building, everyone knew that the Cubs were coming,” a drenched Rizzo said as he celebrated Chicago’s clinching 6-4 victory over St. Louis in the NL Division Series on Tuesday. “And we’re here, and hopefully we can keep this thing going.”

Rizzo, Javier Baez and Kyle Schwarber homered as the Cubs finished off the rival Cardinals with their third consecutive win, leading to a wild scene on the inside and outside of their century-plus-old neighborhood ballpark. It was the first time they had clinched a postseason series at Wrigley, and the North Siders savored the accomplishment — at least for one night.

Much of a raucous, towel-waving crowd of 42,411 lingered as manager Joe Maddon posed for a selfie with his wife, and Jon Lester sprayed champagne with his young son. Rocker Eddie Vedder partied on the mound.

President Barack Obama — who roots for Chicago’s other team — got in on the celebration, too, tweeting his congratulations and noting “even @whitesox fans are rooting for you!”

“We’re going to celebrate this. We deserve to celebrate this,” Rizzo said. “It’s been a long time coming for this city, and hopefully it’s just a sign of things to come.”

The victory in Game 4 allows Chicago to line up ace pitchers Jake Arrieta and Jon Lester for the beginning of the NLCS this weekend.

The Dodgers beat the Mets, 3-1, on Tuesday night and play Game 5 of their division series tonight in Los Angeles. The winner hosts the Cubs on Saturday in the opener of Chicago’s first NLCS since 2003.

“This obviously right now is very rewarding, but we have a couple more series and hopefully we can celebrate like this two more times,” Chicago third baseman Kris Bryant said.

The Cubs had a string of five consecutive losing seasons before they went 97-65 this year. But it was only good enough for third in the competitive NL Central, with St. Louis winning a major league-best 100 games and Pittsburgh finishing second.

Schwarber ball staying put

A Cubs source confirmed to the Chicago Tribune that the ball from the monstrous Kyle Schwarber home run from Tuesday’s series-clinching win over the Cardinals landed on top of the right-field video board.

A Cubs employee was sent to retrieve the ball Wednesday morning, and a source said the team verified it was the actual Schwarber ball through an MLB postseason watermark on it. It will be officially authenticated by MLB Wednesday.

The Cubs have returned it to its original location on top of the board — after it was retrieved and authenticated by MLB — and will leave it there until their postseason run ends.

The source said the Cubs will decide what to do with the ball after the season but wanted to leave it there for now as a memento of the Game 4 win. The Cubs are building a plexiglass case to preserve it from the elements, and will place it on top of the ball Wednesday afternoon.