ST. LOUIS (AP) -- Gerrit Cole was hardly the problem. It wasn't as if the St. Louis Cardinals really figured out the rookie.
The Pittsburgh Pirates' breakthrough season ended in Game 5 of the NL division series because for the second straight game, they couldn't muster much offense.
Adam Wainwright went all the way on the mound and the Cardinals got two-run homers from David Freese and Matt Adams in a 6-1 victory Wednesday night that put them in the NL championship series for the third straight year.
"Wainwright got in the way tonight," Pirates manager Clint Hurdle said. "The at-bats were better, the approach got better, but he kept making pitches. There's no safety net."
Cole gave up just three hits in five innings, but was lifted for a pinch-hitter in the sixth.
"When you've got 12 outs to go and you're down by two, you've got to start doing some creative things," Cole said. "I understand coming out of the ballgame.
"There was stuff left in the tank and we were ready to roll as long as we needed to go."
Freese made the kid pay for a full-count walk to Jon Jay with two outs in the second, lining a 1-2 pitch into the visitors' bullpen in left field.
But it was the offense that betrayed the Pirates when it mattered most.
The top two hitters in the lineup, Starling Marte and Neil Walker, were a combined 1 for 38 in the series. Andrew McCutchen, a leading contender for NL MVP, went 0 for 4 in the finale.
Wainwright scattered eight hits in his second dominant win of the series. Now, the Cardinals get to stay at home to open the NLCS against the well-rested Los Angeles Dodgers on Friday night.
By ending Pittsburgh's storybook season, the Cardinals improved to 8-1 when facing postseason elimination the past three years. They also won Game 5 of the NL division series in Washington last year -- even though Wainwright got rocked -- and at Philadelphia in 2011.
The 23-year-old Cole beat the Cardinals with an impressive effort in Game 2. They got to him early this time on Freese's homer even though the right-hander's fastball hit 100 mph in the first inning against Matt Holliday.
Jay made it 3-0 in the sixth with a two-out RBI single off reliever Justin Wilson.
Adams connected in the eighth against Mark Melancon to make it 5-1. Pete Kozma added an RBI infield single, and Wainwright finished it off by striking out Pedro Alvarez with two on.
Alvarez became the first player with an RBI in his first six postseason games on a fluke hit that caromed off first base in the seventh. But the Pirates, who stopped a record streak of 20 consecutive losing seasons this year, were held to one run in each of the final two games of their first playoff appearance since 1992.
"We were able to take a huge step forward this year in restoring the pride and the passion of the Pittsburgh Pirates' organization," Hurdle said, "and rebonding our city with a ball team."
Despite their charming turnaround and a victory over Cincinnati in the NL wild-card game, the Pirates haven't won a postseason series since the 1979 World Series.
"We're definitely not happy that it's been cut short," Alvarez said. "We have to feed off of this and learn from this and keep gaining experience."
Alvarez didn't find out about the RBI achievement until after the game.
"It doesn't resonate with me," he said. "At the end of the day we're going home early."
Wainwright was helped by three double plays -- two when Pirates runners strayed too far on line drives. The right-hander struck out six and walked one in a 107-pitch complete game.
Sidelined with an arm injury when the Cardinals won the 2011 World Series, Wainwright threw seven innings of three-hit ball to beat Pittsburgh 9-1 in the series opener.
He is 4-0 with a 2.03 ERA and four saves in 15 career postseason games, including six starts. He even helped the Cardinals to a championship as a rookie closer in 2006.
But still, Game 5 last season against the Nationals was fresh in his mind.
"I wanted it bad. It's probably the most nervous I've ever been," Wainwright said. "I don't get a whole lot of nerves when I pitch. Before I pitched today, I was pretty nervous."
The Pirates scratched out their lone run on two infield hits and the single by Alvarez that looked to be a harmless inning-ending groundout before it hit the bag.
At 23 years, 31 days, Cole was the youngest NL pitcher to start Game 5 of a division series and the fifth-youngest NL pitcher to start a winner-take-all postseason game, according to STATS.
Counting the postseason, Cole didn't allow a homer in six straight starts. That ended when Freese connected for a 2-0 lead in the second.
Walker drew a one-out walk in the first from Wainwright, who issued just 35 free passes during the regular season and none in Game 1. Walker went no further.
After a leadoff single by Marlon Byrd in the second, Matt Carpenter was perfectly positioned at second base to snare Alvarez's liner and flip to first for a double play.
NOTES: Marte robbed Carpenter of a hit with a diving catch near the left-field line in the third. ... It was the 24th meeting between the teams this season, with each winning 12 times.