WEMBLEY, England (AP) -- With a change of scenery and a change of quarterback, maybe the San Francisco 49ers can still turn their season around.
After winning only one of their first six games, the 49ers and backup Troy Smith turned it on in the fourth quarter Sunday to beat the reeling Denver Broncos 24-16 in the NFL's fourth regular-season game in London.
"Even though we missed some things early on, I think the rhythm was put in place to make some plays later on," said Smith, who was making his first start as a 49er in place of the injured Alex Smith and the third of his career. "You have to be able to keep your head down and keep even-keeled as a quarterback."
Smith completed three long passes in the fourth quarter to get the offense going. Trailing 10-3 and struggling all day, Smith tied the score by rushing for a 1-yard touchdown after completing back-to-back passes to Delanie Walker , the first for 27 yards and the second for 38 following a scramble.
"It's kind of like watching Brett Favre ," 49ers coach Mike Singletary said of the 38-yarder. "I don't want to put him in the same light, but it's kind of like watching a Brett Favre pass."
Less than 5 minutes later, Smith threw a 28-yard touchdown pass to Michael Crabtree with 7:23 left to put San Francisco (2-6) ahead 17-10. Frank Gore scored another TD with 3:47 to go, running in from the 3.
Smith, the 2006 Heisman Trophy winner from Ohio State, found out only a few days earlier he was going to start at Wembley because Alex Smith was diagnosed with a separated shoulder. And he struggled in the first half, completing 4 of 9 passes for 37 yards.
He finished with 196 yards on 12-of-19 passing.
Gore helped out with a productive day on the ground, rushing for 118 yards on 29 carries.
"We wanted to make sure we established the running game and allow Troy, in his third start in his career, to develop some type of rhythm, develop some type of consistency, some type of confidence," Singletary said. "And not put too much on him too soon."
Singletary wouldn't say whether Smith won the starting job.
"We're going into the bye week, and as far as Alex Smith is concerned, it's a week-to-week deal," Singletary said. "I'll wait and talk to our doctors, trainers, whatever. But we'll make those decisions as we need to."
Orton pulled the Broncos within a score with 2:19 to go in the game, hitting Lloyd for a 1-yard touchdown. But Matt Prater shanked the extra point attempt.
Orton completed 28 of 40 passes for 369 yards. But he also made the only two turnovers of the game. Manny Lawson swatted the ball out of his hand in the fourth quarter, setting up Gore's TD run. Then he threw an interception to Shawntae Spencer as time was winding down.
Lawson also drilled Orton in the third quarter, knocking him to the ground on a third-down pass attempt. Orton was back in for the next possession.
"I know it hurt," Broncos coach Josh McDaniels said. "He showed great grit and toughness for us today as a leader and a captain of staying in the game even though I know every time he threw it after that, there was a lot of soreness."
Although it rained in London for much of the day, it was dry during the game at Wembley Stadium - the home of England's national soccer team and venue for the 1966 World Cup final.
As the home team, the 49ers were able to distribute flags to the 83,941 fans. While spectators were dressed in a myriad of NFL colors, the majority were cheering for San Francisco.
"I wish I could play a game over here every year," 49ers linebacker Takeo Spikes said.
This is the fourth straight year the NFL has played a regular-season game in London. And with another packed Wembley assured in the buildup, NFL Commissioner Roger Goodell was still talking about more games in Britain and possibly a franchise based in London in the future.
"We got to get an NFL team over here. The energy is unbelievable," Spencer said. "The fans, the wave, the flags. It really felt like a home game tonight."
Both teams came into the game off losses. The Niners blew a late lead against the Carolina Panthers and then flew directly to London, while the Broncos arrived Friday after getting blown out by the Oakland Raiders .
"It was good to take time away," Spikes said. "We were forced to be with each other. It was like being in training camp all over again."
The fans were struggling for something to cheer for in the first half, when the only scoring was Joe Nedney 's 34-yard field goal.
The Broncos twice had touchdowns called back. The second would have put them in position to try to tie the game with a 2-point conversion with less than 2 minutes remaining, but an illegal block nullified Eddie Royal 's 78-yard punt return.
"You can't blame the officials, because we put ourselves in those positions," said Lloyd, who finished with 169 yards on seven receptions. "It's really tough to point the finger when we have so many opportunities to do well."
Notes: American singer Michelle Williams performed "The Star-Spangled Banner" and guitar great Jeff Beck did a rock 'n' roll rendition of "God Save the Queen."