Updated

Erik Bedard struck out a season-high 11, including a team-record seven in a row, and the Pittsburgh Pirates set a club mark by fanning 17 batters Thursday in a 6-3 win over the St. Louis Cardinals 6-3.

Bedard (2-4) was pulled after five innings. Pittsburgh relievers kept piling up the strikeouts — the 17 Ks were the most by Pittsburgh in a nine-inning game since 1900, the team said in citing research by the Elias Sports Bureau.

The strikeouts were the most by the Pirates in any game since they fanned 18 Cubs over 20 innings in 1980.

The last time the Cardinals fanned so often in a nine-game game was 1980, when they struck out 18 times against the Cubs. St. Louis struck out 19 times in a 20-inning loss to the Mets in 2010.

In all, 11 different St. Louis struck out.

Pedro Alvarez hit a go-ahead, two-run homer in the sixth as Pittsburgh avoided a sweep.

Clint Barmes had a pair of RBI doubles for the Pirates, who completed a 3-4 trip and will have 18 of the next 25 at home to end May. Jose Tabata, a career .343 hitter against St. Louis, added three hits and a steal.

Jake Westbrook (3-2) lost to Pittsburgh for the second time in three starts, giving up four runs in 6 1-3 innings.

The NL Central-leading Cardinals have won seven of their first eight series, but four times have failed to complete a sweep after winning the first two games.

The Cardinals outscored the Pirates 7-0 in the first inning in the series, and got off to another fast start against Bedard after doubles by Rafael Furcal, David Freese and Allen Craig made it 2-0.

St. Louis had just two hits the next six innings and came up empty with the bases loaded twice, with Matt Holliday hitting a comebacker to end the second and Craig grounding out against Juan Cruz to end the seventh.

Bedard was untouchable between the third and fifth, fanning Craig, Shane Robinson, Tyler Greene, Tony Cruz, Westbrook, Furcal and Jon Jay before Holliday singled with two outs in the fifth.

Though four strikeouts shy of his career high, Bedard's total was the highest by a Pirates lefty since Oliver Perez fanned 14 Astros on Sept. 9, 2004.

Bedard, who threw 104 pitches, has won his last two starts after dropping his first four while pitching well without much support. He hasn't allowed more than two earned runs in any of his starts.

Craig hit an RBI double off the base of the center field wall against Joel Hanrahan with two outs in the ninth. The Cardinals had the tying run at the plate before Hanrahan struck out Matt Carpenter.

Jay was 0 for 2 with two walks and a sacrifice for St. Louis, ending his season-best 11-game hitting streak in which he batted .488 (21 for 43).

Neil Walker singled to start the Pittsburgh sixth and Alvarez followed with his seventh homer and third in four games for a 3-2 lead, the Pirates' first edge of the series.

It was the first homer allowed on the year by Westbrook, a sinkerballer.

Westbrook has never beaten the Pirates, going 0-5 with a 5.06 ERA in 10 games with six starts.

Tabata doubled with one out in the seventh to chase Westbrook, stole third against reliever J.C. Romero and scored on Alex Presley's groundout. Garrett Jones and Barmes hit consecutive doubles with two outs in the eighth off Victor Marte, and Nate McLouth added a run-scoring single off Kyle McClellan in the ninth.

Cardinals pitchers combined for five strikeouts.

NOTES: Pirates star Andrew McCutchen, who got his first day off on Wednesday, left with stomach flu in the fourth. ... Cardinals rookie Lance Lynn is the first Cardinals pitcher to win his first five starts since Bob Tewksbury won his first six in strike-shortened 1994. ... Kyle Lohse (4-0, 1.62) goes for his fifth win Friday when St. Louis opens a three-game series at Houston. Lohse was 2-0 with an 0.60 ERA against the Astros last year. ... Kevin Correia (1-1, 2.42) starts for the Pirates in the opener of a three-game series against the Reds Friday. ... Westbrook's stolen base in the second was the first by a Cardinals pitcher since Joel Pineiro on April 15, 2009, at Arizona.