ST. LOUIS — All season long, Cardinals manager Mike Matheny set 10-games over .500 as a target for his team.

St. Louis, on its tenth try, finally reached that mark with a 10-4 win over the Pittsburgh Pirates on Sunday, but the Cardinals still missed the playoffs for the first time since 2010.

Matt Carpenter homered and Randal Grichuk keyed a six-run seventh-inning with a two-run double to lead St. Louis to its fourth win in a row.

But the Cardinals (86-76) were eliminated while still on the field when San Francisco (87-75) beat the Los Angeles Dodgers 7-1 and earned the second NL wild card.

"That's the danger when it's not in your hands anymore," Matheny said. "Our focus was to take care of our own business, and we did that."

St. Louis starter Adam Wainwright allowed two runs and six hits over six innings. He did not get a decision.

"To miss the playoffs by one game — that's tough to swallow," Wainwright said. "You think about how many times you could've won games, or just one or two games, and you didn't. It gets you to thinking back a little bit."

St. Louis outfielder Matt Holliday was brought into the game briefly to play left field in the ninth inning. He was given a standing ovation and taken out before the first pitch. The Cardinals announced Friday they plan to decline his 2017 option and allow him to become free agent.

"How special was that?" Matheny said. "What instigated it was the response of the fans, so badly they wanted to see him one more time."

St. Louis was a big league-best 100-62 last year but lost to the Chicago Cubs in the Division Series. The Cardinals never led the NL Central at any point this season and finished with a losing record at home (38-43) for the first time since 1999.

"Anytime you don't win the World Series, it's disappointing," said infielder Aledmys Diaz. "But we kept coming and never let down."

"To get close, it definitely makes it a little more disappointing," Carpenter said. "But that's the nature of the business. There's only team that doesn't have this day."

After making the playoffs for three straight years, Pittsburgh dropped from 98-64 to 78-83.

Yadier Molina had three hits for the Cardinals. Stephen Piscotty singled in Molina to break a 4-4 tie in the seventh.

Carpenter hit his 21st homer of the season off Antonio Bastardo for a 4-2 lead.

Jonathan Broxton (4-2) won despite allowing two runs in one inning of relief.

Juan Nicasio (10-7) gave up three runs without recording an out in the seventh.

Andrew McCutchen hit a two-run single in the fifth to give his team a 2-1 lead.

Pittsburgh manager Clint Hurdle is ready to move on from the disappointing campaign.

"Forty-one years in the game and I honour the game, I respect the game," Hurdle said. "And I've also gotten very good on closing the book when it's time to close the book."

Pittsburgh catcher Eric Fryer had two hits in a losing cause.

"I think down the stretch we definitely competed," Fryer said. "There's a lot of optimism here with a lot of young arms."

PACK THE PLACE

A crowd of 44,615, the 19th sellout of the season, watched the final game.

St. Louis drew 3,444,490, second to the Los Angeles Dodgers in major league home attendance. It was the fifth highest attendance total in franchise history and the 13th successive year the team has drawn at least three million.