Aston Villa striker Christian Benteke then had a golden opportunity to put the Belgians ahead but he failed to make contact from Mertens's cutback.
© PA Photos
Benteke came close to giving Belgium the lead soon after the break but his header clipped the top of the crossbar before going behind.
McGregor was booked for time wasting midway through the half before the Scots' resistance was finally broken on 69 minutes.
Chelsea's Eden Hazard worked a corner with Blues teammate Kevin de Bruyne, who swung a cross to the back post that Benteke this time headed home.
The lead was doubled just two minutes later when Manchester City captain Vincent Kompany twisted and turned in the area before lashing past McGregor at his near post from 15 yards.
Croatia had gone top of the group with victory over Wales earlier this evening but Belgium have a superior goal difference so retake first place.