The last two free throws by James came with 10 seconds left and Miami survived when Detroit's Austin Daye was called for traveling before the Pistons could get off a 3-point attempt.
James finished with 32 points, making 9-of-20 from the field and 13-of-14 from the line. Chris Bosh added 27 points and the Heat improved to 8-1 without the injured Dwyane Wade.
Wednesday's game was the only one on the road for Miami in a stretch of nine contests. The Heat had a 4-1 homestand before traveling to Michigan and now will go back home for games against New York, Chicago and New Orleans.
Daye led Detroit with 28 points and Greg Monroe had 20 points and 10 rebounds for the Pistons.
Swim Week Miami Beach 2014 [PHOTOS]