West Virginia overcame a 10-point deficit at halftime to avoid becoming the latest Bowl Subdivision school to lose to an FCS opponent.
Houston transfer Charles Sims rushed for 120 yards and a score in his West Virginia debut and the Mountaineers mustered enough offense to earn their 10th straight win to start a season.
William & Mary's fell short in trying for its first win over an FBS team since 2009 against Virginia.
William & Mary's Michael Graham threw for one touchdown and ran for another. The Tribe built a 17-7 lead but were held out of the end zone after halftime on a hot afternoon.
West Virginia's Paul Millard made his first start at quarterback and threw a 69-yard touchdown pass to Ronald Carswell late in the third quarter that tied the score at 17-17.
A short punt gave West Virginia the ball at midfield with 7 minutes left. K.J. Myers caught a 15-yard pass from Millard at the William & Mary 16 but fumbled and Daikiel Shorts recovered for the Mountaineers.
Two carries by Sims moved the ball to the 2 and Smallwood bulled up the middle for the go-ahead score.
Darwin Cook intercepted Graham at the William & Mary 40 on the next series and West Virginia ran out the clock.
West Virginia looked lost at times to start the post-Geno Smith era, and the Mountaineers' defense made some of the same mistakes that made the unit of the worst in the country last year.
Millard went 19 of 25 for 237 yards with no interceptions. He completed his first eight passes and played West Virginia's first three series. Florida State transfer Clint Trickett was ineffective in the next two series and West Virginia was held to 5 total yards in the second quarter.
Millard returned late in the first half and played the rest of the game.
Several William & Mary running backs got into the open field, and wide receiver Tre McBride exposed the West Virginia secondary's coverage weaknesses.
McBride had three catches for 108 yards. Cornerback Ishmael Banks and safety Karl Joseph were victims of long catches by McBride in the first half that set up Graham's short TD pass to Darnell Laws and Graham's scrambling 5-yard scoring run on third down.
McBride was wide open on a 40-yard catch late in the third quarter, but William & Mary couldn't take advantage. John Carpenter missed a 42-yard field goal attempt.