Updated

Cardinals starter Lance Lynn was hoping to become the National League's fourth 14-game winner. He just didn't give himself much of a chance to succeed.

Lynn allowed three runs on Tuesday night before he recorded two outs, and he and St. Louis were beaten 4-2 by the San Francisco Giants.

"He had to fight all night," Cardinals manager Mike Matheny said. "It didn't come easy for him. A little trouble putting guys away and it ended up costing him in the first."

The big blow in that inning was a three-run homer by Giants catcher Buster Posey, who did his job as a clean-up hitter. Lynn set the table for him by allowing singles to Angel Pagan and Marco Scutaro to start the game. After Lynn retired Melky Cabrera on a fielder's choice, Posey hit his 18th home run 417 feet to center field.

Posey leads the majors with a .448 batting average and 30 RBIs since the All-Star break, including 12 in his last six games. The home run extended his hitting streak to 11 games.

Lynn was trying to be careful but missed with a slider.

"I'm just not getting the guy out when I need to right now," Lynn said. "Maybe I make a good pitch there and he rolls over to short and it's a different ballgame.

"But I've just got to keep working and trying to get better. They're starting to learn what I do. I've just got to keep trying to keep getting better and keep improving."

Lynn put himself in a bind by giving up the early singles.

"It's been kind of the thing that's been my Achilles heel the last couple of starts," Lynn said. "I can't get that first hitter out. I have to battle the rest of the inning because when you're pitching with runners on base you've got to make pitches."

The rest of the evening was better, as Lynn lasted six innings and allowed just one more run.

"He's still giving us a chance," Matheny said. "We had a chance to win today. He's been doing that very consistently for us."

Barry Zito (9-8) pitched 6 2-3 innings to get the win, despite allowing two solo home runs by Allen Craig. He gave up eight hits overall with four strikeouts and no walks.

"You got to keep things simple and not miss the pitchers that he gives you," Craig said. "You can't miss the good ones when he gives you one."

NOTES: Carlos Beltran extended his hitting streak to nine games with a first inning double. ... Ryan Vogelsong (9-5) will face Cardinals rookie Joe Kelly (2-4) in the third game of the four-game set Wednesday. ... Pagan, who also walked, has been on base 14 times in his last 25 plate appearances. ... San Francisco has hit 51 of its 71 homers on the road (72 percent), including eight on its current trip.