SANTA CLARA, CALIF. >> Blaine Gabbert had the stage to himself in San Francisco's quarterback competition with Colin Kaepernick nursing a sore shoulder and provided a strong finish to an uneven performance in the exhibition opener.
Gabbert overcame a shaky start to throw a 43-yard touchdown pass to Vance McDonald before the Houston Texans rallied in the second half against San Francisco's reserves to beat the 49ers 24-13 on Sunday.
"There were ups and downs," Gabbert said. "But we saw when we got into the groove what we can do as a unit."
Brock Osweiler didn't fare as well in his Texans debut, failing to lead Houston to any points in three drives. Houston got on the board early when John Simon returned a fumble by Carlos Hyde 41 yards for a touchdown but struggled to generate any offense with its starters.
"Was it completely what I wanted tonight? Absolutely not. But rarely is it ever," Osweiler said. "I think the biggest thing about tonight is we did some really good things offensively and we know we have some things that we need to work on and grow and get better at."
With Kaepernick sitting out with tightness in his throwing shoulder, Gabbert got to make his case in the battle to win San Francisco's starting quarterback job for first-year coach Chip Kelly.
Gabbert, who started the final eight games last season, did little to improve his position in the first two drives. He was off-target on his first two passes as San Francisco went three-and-out in 41 seconds on the opening drive and started the game 1 for 6 overall.
But he was much more effective on the third drive when he scrambled 13 yards for a first down and then hit McDonald for the long score when Benardrick McKinney slipped in coverage.
"The good thing is that he did settle down," Kelly said. "There were some real positives that we can build on but there were some throws that even if you ask Blaine, he'd say he wished he had those back."
Gabbert finished 4 for 10 for 63 yards and a touchdown.
Osweiler, who signed a $72 million, four-year contract with Houston in the offseason, went 4 for 7 for 27 yards. He took one sack and left for good after throwing an incomplete pass to Braxton Miller on fourth down early in the second quarter.
"To put on the Texan uniform, and run out of the tunnel as a team for the first time, it was certainly special," Osweiler said.
Tom Savage threw two TD passes in the second half for Houston, connecting on a 9-yarder to former California receiver Stephen Anderson and a 9-yarder to Akeem Hunt in the fourth quarter.
Texans: Miller, a third-round pick, had four catches for 34 yards, including an acrobatic 24-yard gain in the third quarter from Savage. First-round pick Will Fuller had just one catch for 4 yards.
49ers: First-round DL DeForest Buckner was pushed around a bit in the running game and finished with one solo tackle and two assists.
Texans: CB A.J. Bouye sat out after injuring his groin Friday in practice and will have an MRI on Monday.
49ers: Backup QB Thad Lewis was 12 for 21 for 97 yards before leaving the game with a lower-leg injury. ... DL Arik Armstead sat out the game after being limited last week in practice by a shoulder injury.
Texans: DL Christian Covington made a good showing as he got a look with the starters with J.J. Watt sidelined with a back injury. Covington forced the fumble by Hyde that led to Houston's first score.
49ers: RT Anthony Davis, who sat out last year in temporary retirement, played with the second string behind Trent Brown in his first game in more than 19 months and was beaten by Eric Lee for a sack late in the first half.
Texans: "Knowing my family and friends are in the stands really supporting me, that was a dream come true," said Anderson, who grew up in nearby San Jose.
49ers: "Colin isn't 100 percent," Kelly said. "It wouldn't have been fair to put him in and judge him on that competition."