Aaron Gordon capped a 10-0 flurry with a go-ahead basket with five seconds remaining in a frantic Orlando rally, before Lopez, fouled on a shot attempt by rival center Nikola Vucevic, calmly dropped in his game-winning foul shots.
After a timeout, the Magic couldn't get off a shot.
Lopez finished with a team-high 27 points and Kyle Kuzma added 20 as the Lakers won for the sixth time in their last seven games overall and seventh time in 11 games since trading for Isaiah Thomas last month.
Thomas contributed 13 points and a game-high nine assists to the win, which allowed the Lakers to break even on a two-game homestand after having lost 108-103 to Portland on Monday.
Gordon had 28 points and 14 rebounds, both game-highs, for the Magic, who lost for the second straight time to open a five-game trip. Orlando was beaten 94-80 at Utah on Monday.
The Lakers led 106-97 with 2:18 to play before the Magic scored the game's next 10 points, including Gordon's go-ahead hoop with just five seconds left.
Los Angeles missed five consecutive shots, including four 3-pointers, before going to Lopez for the final shot.
Kuzma (10 rebounds to complement his 20 points) and Julius Randle (12 points, team-high 11 rebounds) recorded double-doubles for the Lakers, who were drubbed 127-105 on their visit to Orlando in January.
The Lakers were outscored 54-12 on 3-pointers that night. In the rematch, the difference was just 36-33.
Lonzo Ball, who missed the first meeting, had four of the Lakers' 11 3-pointers on a 16-point night.
Vucevic was the fourth player in the game to record a double-double with 24 points and 12 rebounds for the Magic, who lost for the fifth time in a row on the road.
Evan Fournier totaled 11 points, while D.J. Augustin dished off a team-high eight assists to go with nine points.
--Field Level Media
Orlando | L.A. Lakers | |
Aaron Gordon 28 | Scoring | Brook Lopez 27 |
D.J. Augustin 8 | Assists | Isaiah Thomas 9 |
Aaron Gordon 14 | Rebounds | Julius Randle 11 |
Jonathon Simmons 4 | Free Throws Made | Ivica Zubac 4 |
Jonathan Isaac 2 | Steals | Kyle Kuzma 3 |
Nikola Vucevic 2 | Blocks | Lonzo Ball 2 |
Team | Points | FG% | 3PM-3PA | FTM-FTA | Assists | Rebounds | Blocks | Steals | Turnovers |
Orlando | 107 | 50.0 | 12-28 | 11-19 | 31 | 43 | 4 | 5 | 16 |
L.A. Lakers | 108 | 48.9 | 11-33 | 11-12 | 27 | 39 | 3 | 7 | 14 |