Updated

The St. Louis Cardinals stood politely and patiently through a prolonged pregame celebration for the World Series champions, clapping for the San Francisco Giants on several occasions.

If the Cardinals were motivated by the moment, they showed it with an impressive ninth-inning comeback. It just didn't hold up.

Aaron Rowand hit a game-winning single off the left-field wall with the bases loaded in the 12th inning and the Giants celebrated raising the World Series flag with a 5-4 victory over St. Louis on Friday.

"I respected them," manager Tony La Russa said of all the waiting around during pregame festivities. "It was their day. We hung in there."

First baseman Albert Pujols dropped what would have been an inning-ending grounder by Andres Torres with two outs in the 12th. That after the Cardinals should have turned a double play to get out of the inning but Nate Schierholtz beat the relay throw. Torres reached on the error by Pujols and advanced to second on defensive indifference. Brian Tallet (0-1), the sixth Cardinals pitcher, intentionally walked Freddy Sanchez to load the bases. Rowand then drove a pitch to deep left-center, capping a long, festive home opener that lasted 4 hours, 24 minutes.

Nobody was pointing any fingers at Pujols for his bobble.

"That's a tough play right there. He comes sidearm, he's got movement," La Russa said, referring to the throw from Tallet.

Dan Runzler (1-1), the Giants' eighth pitcher, tossed a 1-2-3 12th for the victory.

By the time this one ended, an elaborate 50-minute pregame ceremony seemed like so long ago. The Giants raised their first World Series flag since the New York team did so on April 14, 1955, at the Polo Grounds.

This game featured rallies by both teams, some quirks and even Sunday St. Louis starter Kyle Lohse as a pinch-hitter in the 10th. It marked the eighth time in San Francisco history the Giants went extra innings in their home opener. They are 6-2 in those.

Earlier, Rowand grounded into a rare 7-2-5 fielder's choice on a grounder for the second out of the 11th — normally 7-2-5 is a flyball to left with a runner thrown out at third. But Allen Craig had moved in from left to form a five-man infield with center fielder Colby Rasmus slightly shaded to left, leaving left field completely open.

The Cardinals rallied in the ninth on Ryan Theriot's two-run, two-out single against 2010 majors' saves leader Brian Wilson. Theriot fell behind 0-2 and then singled through the left side of the infield to end a 12-pitch at-bat.

Wilson was replaced by Ramon Ramirez, and in the process glared at plate umpire Bruce Dreckman and angrily fired off words toward him. Wilson threw 15 balls among his 34 pitches.

But St. Louis closer Ryan Franklin couldn't hold a lead either. He gave up Pablo Sandoval's tying, two-out single in the bottom of the ninth and blew his second save of the season in three opportunities after blowing two saves all of last year.

"It was a tough ballgame. It would have been a great one for us to win," La Russa said. "We had our chances."

This marked the Giants' second straight year going extra innings in their home opener. They beat the Braves 5-4 in 13 innings in 2010.

Miguel Tejada hit his first home run for the Giants with a third-inning solo shot and Pat Burrell — one of those castoffs and misfits who helped the franchise capture its first championship since the New York team in 1954 — also had a solo drive off St. Louis starter Jake Westbrook. Freddy Sanchez added an RBI double for San Francisco, which put starter Jonathan Sanchez in position to win before Wilson blew it.

Wilson — the bearded closer — made his way to the mound to a standing ovation. He then allowed a walk, infield hit and plunked pinch-hitter Jon Jay to load the bases with two outs in the ninth. That brought up Theriot.

The Cardinals kicked off a 10-game road trip against the NL West with another quiet day at the plate until late.

St. Louis scored more than three runs for the first time this year. That ended the team's longest such streak since 1919.

"We fought back hard. We fought back off their best guy in the bullpen," Franklin said. "It says a lot. Maybe that can be a thing that will carry over and we can start doing some good things."