GREENVILLE, S.C. -- Sindarius Thornwell scored 24 points, and seventh-seeded South Carolina used sudden hot shooting in the second half to knock second-seeded Duke out of the NCAA Tournament, winning 88-81 Sunday night in a charged-up atmosphere for the second-round game at Bon Secours Wellness Arena.

The Gamecocks (24-10) took advantage of energy provided by a partisan home-state crowd in the biggest victory for South Carolina in at least a generation.

Duke was the preseason No. 1 team and seemed to have gained traction by winning four games in four days to capture the ACC tournament title. The Blue Devils (28-9) rallied from second-half holes in the final three games in that tournament.

South Carolina goes on to meet third-seeded Baylor in the East Region semifinals Friday night at New York's Madison Square Garden.

Chris Silva and Duane Notice pumped in 17 apiece and Rakym Felder provided 15 points for South Carolina. P.J. Dozier scored 11 points before fouling out following a turnover with 3:25 to play.

Grayson Allen scored 20 points, Jayson Tatum had 15, Frank Jackson added 15 and Amile Jefferson supplied 14 for Duke.

Luke Kennard scored 11 points, fouling out with 1:38 left.

South Carolina pulled ahead 39-38 with 15:10 left.

The Gamecocks, who shot woefully in the first half, made 12 of their first 16 attempts from the field in the second half.

They led 60-53 with less than nine minutes to play, resulting in Duke's second timeout of the half. The margin grew to 68-58 at the five-minute mark.

Duke senior guard Matt Jones fouled out at the 2:58 mark after scoring six points.

Kennard, the team scoring leader, picked up his third foul with 17:22 left and his fourth at the 12:03 mark.

Duke led 30-23 at the half, in part because South Carolina shot 20.6 percent from the field. The Gamecocks made 7 of 35 shots, with twice as many attempts as Duke (17).

Allen delivered seven points and two assists in helping Duke to an 18-14 lead.

South Carolina went more than six minutes without scoring, while Duke built a 24-14 edge during that time.

Duke had 10 turnovers and 10 fouls barely 16 minutes into the game.

NOTES: Duke and South Carolina met for only the second time in 46 seasons. ... Duke coach Mike Krzyzewski failed in his bid to take a team to the Sweet 16 for a record 24th time. ... South Carolina had never advanced to the Sweet 16 under the tournament's current format. When the Gamecocks defeated Marquette on Friday night, it was their first NCAA Tournament victory since 1973. ... South Carolina overcame a 10-point deficit to defeat Marquette in the first round for its biggest comeback to result in a victory this season.