Gloucester wing Rees-Zammit had scored just before half-time to keep Wales in the contest, with his second – after Liam Williams and Wyn Jones had also crossed over – confirming a bonus point.
Hogg did briefly put Scotland back in front, but Pivac’s team held their nerve to claim their first win on foreign soil in five attempts under Warren Gatland’s replacement.
There was no repeat of last week’s Twickenham knee-gate row as all 23 Scotland players plus the visitors remained standing with heads bowed during the ‘moment of reflection’ called for by the tournament organisers to show support for the fight against racism.