The Nittany Lions won a Big Ten Conference game for the first time this season, overcoming a 15-point deficit in the final 10:30.
Marshall scored 25 points, his second-largest production of the season, and finished his night by grabbing the rebound on a missed 3-pointer by Michigan's Trey Burke with 9 seconds remaining to clinch the win.
Of the 340 schools competing in the 31 conferences that receive an automatic berth into the NCAA tourney, Penn State had been one of just two without a league victory.
Grambling, of the Southwestern Athletic Conference, is the lone team remaining that does not have a league win this season.
D.J. Newbill added 17 points for Penn State (9-18, 1-14 Big Ten) and Ross Travis had 15.
Marshall's two free throws with 3:55 to play gave Penn State the lead for good and Michigan managed only four points the rest of the way. The Nittany Lions took an 81-78 lead on Marshall's jumper with 1:08 to go.
Michigan (23-5, 10-5) fell 1 1/2 games behind Indiana in the race for the regular-season conference title. The Hoosiers (12-3) lead Michigan State and Wisconsin by a game.
The Wolverines were paced by Tim Hardaway, Jr. with 19.