In the feature attraction of college football's opening night, the game was delayed for 2 hours during the fourth quarter by lightning strikes that hit close to the packed stadium.
Once the action resumed, the teams briskly completed the contest.
Shaw led the Gamecocks to a 17-point first period and finished with 149 yards in the air and 43 on the ground. Mike Davis gained 115 yards on 12 carries for South Carolina, including a 75-yard run in the third quarter for the game's final touchdown.
The opening kickoff left South Carolina with the ball at its own 18-yard line and Davis totaled 17 yards on two carries to start the contest.
Shaw then hit Shaq Roland with the long touchdown throw that put the Gamecocks in front to stay.
Elliott Fry kicked the first of his two field goals from 39 yards later in the period and backup quarterback Dylan Thompson came in to throw threw a 29-yard pass for a score to Kane Whitehurst to complete the early surge.
The Tar Heels closed within 10 points early in the second quarter on a 4-yard throw from Bryn Renner to Quinshad Davis and North Carolina soon forced a punt by the Gamecocks from deep in their end of the field.
Owning the momentum and about to get the ball at midfield, North Carolina wasted the chance when T.J. Thorpe fumbled away the punt.