Brian Hoyer made the most of his limited opportunity Saturday night.

Hoyer threw a 58-yard touchdown pass to Cecil Shorts III on Houston's first drive in the Texans' 23-10 victory over the San Francisco 49ers in the preseason opener for both teams.

Competing with Ryan Mallett for the starting job, Hoyer also connected with DeAndre Hopkins for a 2-point conversion to give the Texans an 8-0 lead. Hoyer finished 2 for 4 for 67 yards.

More from FoxSports

Mallett completed his first eight passes and was 10 of 11 for 90 yards, but the Texans didn't score on any of his four possessions.

Colin Kaepernick failed to move the offense on his only drive, going 1 for 3 for 14 yards before a punt.

Mallett took over for Houston's second drive and moved the Texans down to the 1-yard line before the offense stalled. Houston had eight chances to score after that thanks to a pass interference call, but couldn't convert.

Blaine Gabbert was 8 of 11 for 86 yards and a touchdown for San Francisco.

Former Australian professional rugby player Jarryd Hayne, who was playing in his first NFL game, had a 53- yard run early in the second quarter. Hayne, who was signed as an undrafted free agent in March, burst through the line before juking a defender and dashing to the 13. Gabbert found Garrett Celek two plays later on a 10-yard touchdown pass to make it 8-7.

Jaelen Strong, a rookie third-round pick, caught a 10-yard touchdown pass from Tom Savage to give Houston a 15-10 lead early in the third quarter.

Texans linebacker Jason Ankrah sacked rookie Dylan Thompson in the end zone for a safety to extend the lead to 17-10 later in the third.

Houston's Alfred Blue had nine carries for 59 yards, highlighted by a 32-yard trot in the first quarter. He'll likely start for the Texans with Arian Foster out indefinitely after groin surgery last week.

Defensive end J.J. Watt, last year's Defensive Player of the Year, was in uniform, but didn't play.

Randy Bullock added two 41-yard field goals for Houston in the fourth quarter.