McLeish named a more familiar looking lineup for the game, making seven changes to the side which lost to Costa Rica.
Scotland began brightly but were nearly caught out at the back three minutes in as Charlie Mulgrew slipped to allow Balazs Dzsudzsak to gain possession, though the Hungary captain's shot from 18 yards was weak.
Both sides traded blows throughout the first half but the visitors were given a golden chance to edge into the lead when Laszlo Kleinheisler brought Fraser down in the box for a penalty.
Mulgrew opted to try his luck from 12 yards but his effort from the spot was pushed away by goalkeeper Peter Gulacsi to leave the game on a knife's edge come the break.
Scotland struck what turned out to be the decisive blow shortly after the restart, Phillips tapping home past Gulacsi from Fraser's delivery.
HUNGARY (3-4-3): Gulacsi; Fiola, Otigba, Guzmics; Viera, Pinter (Szabo 45'), Kleinheisler (Patkai 67'), Hangya (Lazok 45'); Edmundsson (Nikolic 83'), Szalai (Bode 77'), Dzsudzsak (Nemeth 58')
SCOTLAND (3-4-2-1): McGregor; Hendry, Mulgrew, McKenna; Fraser (Paterson 82'), McGinn, Armstrong (McLean 70'), Robertson (Douglas 67'); Forrest (Christie 77'), McGregor (Cummings 90+3'); Phillips (McBurnie 84')