Utah led throughout the contest, owning as much as a 16-point advantage in the third quarter.
The Magic, however, took a one-point lead when Glen Davis scored on a dunk with 3:38 to play.
Foye followed with a 3-pointer 21 seconds later and Utah did not trail again. Orlando's final points came at the foul line from Jameer Nelson with 2:09 to play.
The Jazz ended a three-game losing streak with Al Jefferson hitting 13-of-20 from the field and scoring 31 points. Paul Millsap added 22 points for Utah, which won despite making just 41 percent of its field goal attempts and converting only 1-of-10 tries from 3-point range.
Davis led the Magic with 18 points and Nelson had 17.
Utah has a 3-9 road record, but this was its seventh victory in eight home games.
Swim Week Miami Beach 2014 [PHOTOS]