Newbill made one of two free throws and Ross Travis missed the next two from the line. Newbill failed to convert on two more free throws in the final 14 seconds, helping the Huskers (10-9, 1-5 Big Ten) escape with the victory.
Shields went 10 of 11 from the floor and made all eight of his free throws for Nebraska. As a team, the Huskers went 16 of 16 from the free throw line.
Jermaine Marshall scored all of his 18 points in the second half for the Nittany Lions (8-10, 0-6).
Penn State trailed 33-28 at the end of the first half, but quickly went on a 12-0 run. A short jumper by Travis at the 11:56 mark of the second half put the Nittany Lions ahead at 43-41. It was their first lead since Nebraska trailed 7-6 with a little more than 13 minutes remaining in the first half.
Marshall was fouled shooting a three with 8:11 remaining, and made all three of his shots from the line to put Penn State ahead 52-48 -- its largest lead of the half.
Nebraska countered with nine straight points, capped by an easy fast break layup by Gallegos off a Newbill turnover with a more than four minutes remaining to quiet the home crowd in the Bryce Jordan Center.
Gallegos knocked down a 3-pointer a couple minutes later to fend off Penn State, who had cut the Huskers' lead to three. Marshall converted a three-point play to make the score 61-58.
Gallegos hit three 3-pointers in the game, but both teams struggled mightily from beyond the arc. Nebraska shot 4-of-13 from the 3-point line, while the Nittany Lions shot 5 of 20.
adidas Men's Nebraska Cornhuskers Fired Up Scarlet Performance T-ShirtPrice: $21.99 Shop
Andrew White III will return to the Nebraska men's basketball team next season after removing his name from the NBA draft.
Mike Brey is looking at former Notre Dame players to fill two assistant jobs that have opened up with the departures of Martin Ingelsby and Anthony Solomon.
Purdue's 2016-17 prospects got a jolt Wednesday when forward Caleb Swanigan announced he will return for his sophomore season.