Maryland Coach Brenda Frese participated in the Terrapins’ “white-out” Monday night, when her team could not quite erase a 26-point deficit. (Toni L. Sandys/The Washington Post)

Dawn Staley stood in front of her team’s bench Monday night at Xfinity Center decked in all black, from the pointy stilettos on her feet to the thick glasses perched on the bridge of her nose. On the other side of the floor, Maryland women’s basketball Coach Brenda Frese paced in a white suit, chosen to coordinate with the “white-out” the Terps had planned in advance of hosting Staley’s reigning national champion South Carolina Gamecocks.

Staley had accepted Frese’s invitation to College Park, then dressed the part of the villain. She and her players savored their role as bad guys, spoiling a thrilling comeback led by Kaila Charles’s 19 points in the fourth quarter and defeating Maryland, 94-86, in front of a rowdy crowd of 8,677.

It was the Terrapins’ first big test of the season.

“We know that the second game of the season isn’t going to be who we are come January, February, March, so these type of games, being able to learn,” Frese said after. “. . . I loved the fight of our team. I thought our chemistry really came together late in the third quarter, and then I thought you saw a true picture of our team in the fourth quarter when we settled in and got into playing Maryland basketball.”

When Frese looks back in March, the Gamecocks (2-0) may prove to be one of Maryland’s biggest challenges all year.

No. 4 South Carolina arrived at Xfinity Center for the first game of a home-and-home series, which takes the No. 15 Terps (1-1) to Columbia next year, carrying much of the momentum from last season’s national championship — the first national title for Staley, who went to the Final Four three times as a player at Virginia but never won.

The Gamecocks lost three key scorers from last season but still have senior forward A’ja Wilson, the jewel of Staley’s program who erupted for 23 points in April’s title game. She put up a career-high 32 on Monday on 10-for-19 shooting and added 12 rebounds, one shy of teammate Alexis Jennings’s game high. Wilson led a crisp offense that ended up shooting 46 percent from the floor, though the Gamecocks shot 63 percent in a dominant first quarter and finished with four scorers in double figures.

“They hit every shot to start the game,” Frese said. “A’ja Wilson is a woman amongst girls. She should be in the pros. She’s just that talented.”

After a weak opening half had them down 15 points at intermission, the Terrapins stepped up to the challenge.

Maryland started shakily and committed eight first-half turnovers, including four in the first four minutes, as South Carolina ran it up and down the floor.

Maryland trailed by 26 with 2:20 left in the third quarter but began chipping away as the Gamecocks grew tired on defense. A three-pointer from senior guard Kristen Confroy narrowed the gap to seven with 2:47 left in the game, and the teams traded free throws before a layup from freshman point guard Channise Lewis put Maryland within three with less than a minute left.

A pair of free throws from South Carolina point guard Tyasha Harris iced the game with 18 seconds to play.

“I thought we got a little fatigued,” Staley said. “That is, shooting the ball too quickly and allowing them to get the ball back and play fast and downhill like they like to play. I thought they just controlled the tempo in the second half, in the fourth quarter.”

For a team still finding its feet after losing three key players, including two all-Americans from last year’s team, Maryland could be proud of its comeback effort.

The Gamecocks brought a fierce defense to College Park but outrebounded the Terps just 41-36. Charles led the team with a career-high 31 points on 8-for-16 shooting and had 10 rebounds, and sophomore guard Blair Watson added 14 points.

“That’s the Kaila we have to have,” Frese said. “She had four points at halftime. . . . When she’s attacking the rim and getting to the free throw line 15 times, you see that nobody in the country can stop her.”

Lewis, who handled her first start as a Terp with panache, finished with seven points and two assists. Maryland got a solid 19 points from the bench, including eight from senior guard Iesha Small, who also had eight rebounds.

Though Maryland couldn’t overcome its early mistakes with late-game heroics, Frese said Monday’s game should give the Terps confidence as they wade through a sticky nonconference slate. They play No. 1 Connecticut on the road Sunday.

“Heck, yeah,” Frese said, “I told them in the locker room [after the game], when we were down 26, most teams would have folded. Most teams would have put their head down and rolled over and called it quits, but I thought this team showed a lot of fight and a lot of pride to be able to fight to the bitter end.”