The game was part of the Coaches vs. Cancer Classic, which shifts to Brooklyn next week.
Nastic was 11 of 14 from the field and made all four of his foul shots. Brown was 6 of 8 and made Stanford's only 3-pointer.
The Cardinal opened the second half by outscoring the Terriers 18-7 and opening a 20-point advantage.
Collins hit a jumper to give Wofford a 24-23 edge with 4:54 remaining in the first half. It was all Stanford the rest of the way,
Brown connected on a 3-pointer 20 seconds later, sparking a 13-3 run to put the Cardinal ahead 36-27 by halftime.
Wofford: The Terriers started their season on the road for the 21st consecutive year. The Terriers are 1-19 in their last 20 season openers. Wofford last played in California at Santa Clara's Cable Car Classic in 2009.
Stanford: The Cardinal opened their 100th season with the late night game against Wofford. Former Stanford star Casey Jacobsen served as the analyst to Ted Robinson for television. Randle moved into a 10th-place tie (547) with Jacobsen on Stanford's all-time field goals made list
Wofford hosts Iona in its home opener on Tuesday at 7 a.m. local time as part of ESPN's 24-College Hoops Tip-Off Marathon.
Stanford welcomes South Dakota for a game on Sunday.