Raja Bell hit a 3-pointer and sank two free throws to give the Jazz a 100-97 lead with 17.9 seconds left.
Tayshaun Prince led Detroit with 26 points on 11-of-19 shooting and McGrady came within one rebound of a triple double. He had 11 points, 11 assists and nine rebounds.
The game was tied 15 times with 11 lead changes.
The Jazz went on a 16-4 run in the second quarter to take a 41-32 lead. Utah's reserves once again were the spark, with Ronnie Price igniting the crowd with a dunk and a twisting layup, and C.J. Miles adding a put-back, three-point play and 3-pointer.
Miles was back in action after missing two games with flulike symptoms. He led Utah in scoring in the first half with 11 points as the Jazz took a 53-51 lead into the locker room.
The Pistons led 28-25 after the first quarter thanks to a pair of 3-pointers by rookie Ben Gordon, who started 3 of 5 overall.
Jefferson had the hot hand early for Utah, hitting his first four shots. He finished with 16 points, eight rebounds and thee blocks, while Paul Millsap had 15 points and 10 rebounds.
NOTES: Stuckey returned to action after battling a stomach ailment. He did not start but played 13 minutes and scored 3 points. ... Jazz reserve C Mehmet Okur missed his third straight game with a lower-back injury. ...Jazz coach Jerry Sloan was asked, in light of the Seattle Seahawks hosting a home NFL playoff game, whether it would be OK if that occurred in the NBA. "Are they supposed to apologize?" Sloan said after noting Dick Motta won a championship in Washington despite winning just 44 games during the 1977-78 regular season. ... McGrady, starting in place of Stuckey, had six assists in the first half. ... Utah held a 38-28 advantage in points in the paint but was outrebounded 39-35.