SANTA CLARA, Calif. (AP) Blaine 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 in the exhibition opener for both teams.

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.

With Colin Kaepernick sitting out with tightness in his throwing shoulder, Gabbert got the stage to himself in the battle to win San Francisco's starting quarterback job for first-year coach Chip Kelly.

More from FoxSports

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.

Gabbert finished the game 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.

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.

ROOKIE WATCH

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.

INJURY UPDATE

Texans: Several Houston starters sat out the game, including DL J.J. Watt (back), LB Jadeveon Clowney (knee) and rookie C Nick Martin (back). MLB Brian Cushing also did not dress for the game but was not hurt.

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.

POSITION BATTLES

Texans: DL Christian Covington made a good showing as he got a look with the starters with Watt sidelined. 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.

---

AP NFL website: www.pro32.ap.org and AP NFL Twitter feed: http://twitter.com/AP-NFL