Trailing 2-1 entering their final at-bat, Buster Posey singled with one out off Ryan Franklin (0-1). Pat Burrell drew a walk and one out later Tejada roped a double to left center that was bobbled by Colby Rasmus, and the Giants came away with a dramatic win.
Giants starter Matt Cain got a no-decision after a solid, seven-inning performance in which he surrendered two runs on five hits, striking out four.
The victory went to Ramon Ramirez (1-0), who pitched a 1-2-3 top of the ninth.
Rasmus hit a seventh-inning solo homer for the Cardinals.
St. Louis starter Jaime Garcia went six innings, giving up only one run on four hits while striking out nine in a no-decision.
2014: The Year in Music [PHOTOS]