The dramatic decision came in the 117th meeting between the rivals and allowed the No. 12 Ducks to finish the regular season with a 10-2 record. They wound up at 7-2 in the Pacific-12 North Division after their bid for a national title collapsed late in the season.
Oregon State came close to pulling off the upset when Victor Bolden ran 25 yards for a score with 1:38 to go, putting the Beavers in front 35-30.
Mariota then led the Ducks 83 yards in 10 plays, hitting Huff with a scoring throw of 12 yards. A 2-point conversion attempt failed.
It was Oregon's sixth straight win over the Beavers.
Huff caught three touchdown passes and compiled 186 receiving yards on nine catches. Mariota went 17-of-34 for 285 yards, but was intercepted twice.
Oregon State scored 17 points in the second period to create a 17-17 tie at halftime Sean Mannion completed 29-of-47 passes for 314 yards and two touchdowns with one interception.
The Beavers finished at 6-6 and were 4-4 in the Pac-12 North.