The Astros won for the 10th time in 12 games with a late surge that made a winner out of Oscar Villarreal (1-3).
Villarreal threw only four pitches and recorded just one out, but he was the pitcher of record when Tejada drove in Kazuo Matsui in the seventh to give the Astros a 4-3 lead.
With Billy Sadler on the mound for San Francisco in the eighth, Hunter Pence led off with a single. One out later, Ausmus hit his first homer of the year.
Jose Valverde, Houston's seventh pitcher of the game, came on in the ninth to pick up his 10th save.
The loss went to Jack Taschner (2-1), who surrendered the seventh-inning run in just two-thirds of an inning of work.