Smith completed just three of nine passes and threw an interception.
A source told ESPN NFL Insider Adam Schefter last week that Smith was going to have to play very well to beat out Hill for the starting job. Meanwhile, 49ers coach Mike Singletary said he needs to "look at some more film" before making the decision as to who gets the job.
The 49ers visit Dallas next Saturday.
Hill was 3-for-7 for 20 yards after taking over to start the second quarter, and the 49ers, behind the running of Michael Robinson, were in field-goal position on both of his full series.
Rookie Nate Davis led the Niners to three scores in the fourth quarter, with Kory Sheets' 5-yard run giving San Francisco a 21-14 lead. Charlie Frye scored on a 14-yard run for Oakland but threw an incompletion on the 2-point conversion attempt with 3:30 to go.
The game came the same week that coach Tom Cable was accused of breaking assistant Randy Hanson's jaw in an attack that is being investigated by the police and the NFL.
Smith, the No. 1 overall pick in the 2005 draft, was expected to be San Francisco's franchise quarterback, but Smith has struggled when healthy before missing much of 2007 and all of last season with an injured shoulder.
He completed a 15-yard pass to Vernon Davis on his first drive before it stalled and then made his best play on the second. On a reverse to Arnaz Battle, Smith lowered his surgically repaired right shoulder into defensive end Greg Ellis, knocking him to the turf. Battle lost 6 yards on the play, but Smith drew cheers for his block.
Two plays later, Smith threw high to Josh Morgan and the ball deflected into Ricky Brown's hands. Brown returned the ball 47 yards before being tackled by Smith at the San Francisco 7. Smith threw only one more pass before leaving after the first quarter.
Hill, who went 5-2 as the starter last season, wasn't a whole lot better than Smith although he did avoid turnovers. The Niners relied heavily on rookie running back Glen Coffee in the second quarter.
Coffee, a third-round pick out of Alabama, gashed Oakland's run defense, ripping off four runs of at least 10 yards, including a 35-yarder that led to a field goal by Joe Nedney. Coffee, who replaced Frank Gore after one series, finished with 129 yards on 16 carries.
JaMarcus Russell started slowly for Oakland, missing an open Darrius Heyward-Bey on third down of his first drive and tripping over Darren McFadden's feet on third down on the second drive. After Brown's interception, Russell was unable to get Oakland in the end zone, throwing high to Murphy in the back of the end zone.
Russell found his groove on the next drive, starting with a 12-yard pass to Zach Miller. He completed an 11-yard swing pass to Justin Fargas and then got a 22-yard gain when Nate Clements was called for pass interference against Johnnie Lee Higgins.
After a pair of penalties backed Oakland up, Russell took advantage of a miscommunication between Clements and Mark Roman to find a wide open Murphy in the end zone on third-and-21 to end his night. That was Russell's only completion to a wide receiver all night. He finished 7-for-11 for 76 yards.
Jeff Garcia made his Oakland debut and threw an interception to end his only drive late in the second quarter.
Adam Schefter is an NFL Insider for ESPN. Information from The Associated Press was used in this report.
Indianapolis Colts quarterback Andrew Luck will not play Sunday against the Jacksonville Jaguars because of a right shoulder injury, a team source told ESPN's Chris Mortensen.
Texans running back Arian Foster, barring a pregame setback, will make his 2015 debut against the Falcons, a source told ESPN NFL Insider Adam Schefter on Sunday.
Quarterback Jay Cutler will test his injured hamstring prior to Sunday's game, and the Bears are optimistic he'll play against Oakland, a source told ESPN NFL Insider Adam Schefter.
Eagles running back DeMarco Murray, who has been hampered by a hamstring injury, is expected to play against the Redskins, a source told ESPN NFL Insider Adam Schefter.
Jets receiver Eric Decker, who was listed as questionable with a knee injury, was active for Sunday's game against the Dolphins in London.
Drew Brees told ESPN NFL Insider Ed Werder that he believes his passing shoulder is healthy and he is capable of making every throw necessary when the Saints host the Cowboys on Sunday night.