DETROIT -- Max Scherzer headed off the mound and toward the dugout, where manager Jim Leyland was waiting to offer a congratulatory handshake.

After 15 strikeouts in seven innings, Scherzer's day was done, and the only question was whether the Detroit right-hander's fine effort would go to waste.

"We're in this business to win," Scherzer said.

And win the Tigers did. Alex Avila's tiebreaking, two-run single highlighted a three-run seventh that sent Detroit to a 4-3 victory over the Pittsburgh Pirates on Sunday. Scherzer's 15 strikeouts were the most by a Tigers pitcher in 40 years, and his teammates wiped out a 2-1 deficit to get him the victory.

Mickey Lolich had 15 strikeouts for the Tigers against Boston on Oct. 2, 1972, and set the club record of 16 in 1969, doing it twice in less than three weeks.

Scherzer's 15 strikeouts were the most by a major league pitcher this year. Miami's Anibal Sanchez had 14 against Arizona on April 28.

"We've wasted a few good performances this year already," Avila said. "Hopefully, that will kind of get us on a roll a little bit."

Detroit trails first-place Cleveland by three games in the AL Central.

Scherzer (3-3) threw 115 pitches. He allowed four hits, including two solo homers, and a walk.

Avila's hit made it 4-2. Pittsburgh scored a run in the ninth off Joaquin Benoit, but he held on for his first save this season. Detroit closer Jose Valverde has a strained back.

Kevin Correia (1-5) allowed three runs and four hits in six-plus innings.

Scherzer gave up seven runs in 2 2/3 innings in his first start of the season, and although he's been better since then, he entered Sunday's game with a 6.26 ERA. He was locked in from the start, throwing his first 10 pitches for strikes before finally missing the zone against Pedro Alvarez, the first hitter of the second. Scherzer got Alvarez anyway for his third strikeout of the day.

"Even when I've struggled, I've always believed the next time I go out there that I'm going to have a great start, no matter what," Scherzer said. "That's always been my belief ever since I've been in the big leagues, and today was no different."

All 15 of Scherzer's strikeouts were swinging. The only other pitcher since 1988 to strike out at least 15 -- all swinging -- in a game was Houston's Mike Scott, who fanned 15 Cincinnati Reds on June 8, 1990, according to STATS LLC.

"My changeup was really working well today. I was able to throw it to both lefties and righties, and I was able to generate swing-and-misses out of it," Scherzer said. "I was able to throw it for a strike and throw it just underneath the zone to help generate some swing-and-miss strikeouts."

Scherzer had struck out five straight -- and 10 for the game -- when Rod Barajas homered with one out in the fifth to give the Pirates a 1-0 lead. Jhonny Peralta answered with a solo shot in the bottom half.

Neil Walker hit a 407-foot homer in the sixth, and Scherzer's pitch count began creeping up, precluding a run at the big league record of 20 strikeouts for a nine-inning game. Scherzer was actually on the hook for a loss when Leyland offered his handshake after the top of the seventh, the signal that a reliever would be entering in the eighth.

But Prince Fielder led off the bottom of the seventh with a blooper to left that dropped between shortstop Clint Barmes and left fielder Nate McLouth. Barmes had a long way to run because the infield was shifted around to the right, and when the ball hit the ground, it bounced weirdly up off him into foul territory, enabling Fielder to reach second with a double.

Delmon Young followed with a tying single, and Tony Watson relieved Correia. Peralta drew a walk one out later, and a passed ball by Barajas allowed the runners to move up to second and third. The Pirates brought the infield in, but Avila's base hit up the middle foiled that strategy and made it 4-2.

Detroit was without center fielder Austin Jackson (abdominal strain) and Valverde, but the Tigers ended up taking two of three from Pittsburgh. Scherzer and Justin Verlander bookended the series with brilliant pitching performances. Verlander threw a one-hit shutout Friday night, striking out 12 and giving up only a ninth-inning single to Josh Harrison.

The Pirates struck out 17 times Sunday and 41 times in the series.

Game notes

Detroit's Brennan Boesch had his 12-game hitting streak snapped. ... Pittsburgh dropped to 19-9 when scoring at least two runs. ... The Tigers are off Monday. The Pirates return home and will send LHP Erik Bedard (2-5) to the mound against Johan Santana (1-2) of the New York Mets.