DENVER -- Peyton Manning got the jump on the 49ers. The 49ers overtook him in the end, though.
David Akers kicked four of his five field goals in the second half and San Francisco withstood Peyton Manning's first two touchdown passes since joining the Denver Broncos to give the 49ers a 29-24 exhibition victory on Sunday.
Alex Smith played most of the first half for the 49ers and had a touchdown pass to his fleet tight end, Vernon Davis, for the team's first points, touching off a comeback sustained by the team's reserves after San Francisco had fallen behind 17-0.
"Give them credit. They came out and Peyton Manning, he was connecting with his wide receivers, doing a great job," Davis said. "Alex came back and he was like, 'We got to go. It's preseason, but we got to go. We have to make a statement.' So we went in as soon as the opportunity came and we took advantage of it."
Manning, who joined the Broncos as a free agent after 14 illustrious seasons with Indianapolis, completed 10 of 12 passes for 122 yards in his most effective outing since coming back from a neck injury that sidelined him during his final season with the Colts.
"I think he's ready," Broncos running back Willis McGahee said. "I think he's been ready. He's our quarterback."
Added Manning: "The offense was excited to move the ball. I thought we had some rhythm."
The 49ers had some rhythm of their own.
"There was a lot of football to be played, and our guys started playing a little better, got in a better rhythm, started coming off the ball, tackled a little better, did better things," 49ers coach Jim Harbaugh said. "We expect that and it's good to see when that happens."
Trailing by 14, the 49ers' reserves closed with a run of 19 straight points, including Akers' fourth field goal, a 32-yarder with 9:22 left to play, that put the 49ers in front by two points, their first lead of the day.
Akers had one more field goal, a 44-yarder, with 3:01 to play.
There was some confusion before Akers kicked the go-ahead field goal among the group of replacement officials.
Broncos coach John Fox sought to challenge a ruling that 49ers quarterback Scott Tolzien lost the ball at the end of a scramble after hitting the ground, negating an apparent fumble. It was determined that the ruling was not subject to challenge and initially the officials flagged Fox for unsportsmanlike conduct for trying to lodge the challenge. After some discussion, the officials picked up the flag, however.
The 49ers, who were held to 14 yards rushing on nine attempts in the first half, got a boost from their running game in the second half and also were helped by a penalty on the Broncos.
Rookie Omar Bolden was flagged for interfering with receiver Brett Swain, giving the 49ers a 31-yard advance to the Broncos' 35-yard line.
On 3rd-and-1, fullback Anthony Dixon broke through the line and into the clear for a 26-yard touchdown, pulling the 49ers to within 24-17 with 12:51 remaining in the third quarter. Dixon finished with 58 of the 49ers' 140 yards rushing, 126 of which came in the second half.
"We just kept fighting, that's all it was," Dixon said. "We didn't really run different plays. And we figured out what they were trying to do to us. We went in (at halftime), made the adjustments and got going."
Manning led three first-quarter scoring drives before leaving, and the Broncos went on to take a 24-10 halftime lead when Caleb Hanie hooked up with tight end Joel Dreessen for a 5-yard touchdown pass on one of the final plays of the second quarter.
Matt Prater ended the Broncos' opening possession with a 53-yard field goal.
Over the next two series, both ending in touchdowns, Manning completed eight consecutive passes, the longest a 38-yard completion to running back Lance Ball in which the quarterback shook off a hit from linebacker Parys Haralson.
"He's a player and a coach in itself," 49ers linebacker Ahmad Brooks said. "I just think he knew what we were going to do before the snap even happened. He's just an excellent player."
Manning later connected on the first of his scoring passes, hitting Eric Decker from 10 yards out after the Broncos wide receiver got a step on cornerback Carlos Rogers.
The Broncos turned a fumbled snap by Smith, which was recovered by linebacker Wesley Woodyard at the 49ers' 24-yard line, into another score when Decker caught a 5-yard touchdown pass from Manning.
Up 17-0, the Broncos tried a surprise onside kick but were flagged for illegal touching when Matthew Willis grabbed the ball before it traveled 10 yards, giving San Francisco possession at Denver's 44-yard line.
"We got lucky on that one, because they had it on us," Harbaugh said. "Good on them. They pulled it out at the right time and we were lucky that it didn't work for them and it worked for us. But it was really more of a luck thing for us."
What happened next was no stroke of luck, just solid execution.
Smith threw a strike to Davis, who ran by linebacker Von Miller, for a 44-yard touchdown for the 49ers' first points of the day.
"It was a good matchup, had him matched up on a linebacker," Smith said. "He's a special player. It was great protection up front and it was just a good look. We made the most of it."
Perrish Cox, a former Bronco trying to win a roster spot with the 49ers, intercepted a Hanie pass to set up a 33-yard field goal by Akers. Hanie and his intended target, Decker, appeared to have a miscommunication on the route, allowing Cox to step up uncontested for the ball when Decker broke deep.
NOTES: Ball left the game late in the first quarter with a chest injury and did not return. ... San Francisco running backs LaMichael James (left ankle) and Brandon Jacobs (left knee) sat the game out with injuries. ... Randy Moss made his first start as a 49er but did not have a catch. ... Harbaugh said X-rays were negative on Ted Ginn Jr.'s ankle. Ginn left the game in the third quarter after hurting the ankle when he was tackled at the end of a 9-yard run on an end-around. ... The teams have their first roster cut on Monday, with each squad trimming down to 75 players.