Shotton, on a month’s loan from Premier League Stoke, stole in unmarked to nod home Andy Taylor’s inviting free-kick on 49 minutes and seal all three points.
Huddersfield had gone ahead on 16 minutes when striker Liam Dickinson curled a superb free-kick past Danny Coyne after being brought down by Taylor.
Nathan Clarke saw a point-blank header tipped onto the crossbar by Coyne for Huddersfield, before Edrissa Sonko equalised in the 39th minute.
The Gambian international stunned the home faithful with an unstoppable right-foot volley from the edge of the area after Chris Greenacre’s lay-off.
Shotton’s strike then gave Tranmere the initiative, and Chris Greenacre blazed wide after latching onto Shotton’s through-ball.