Lopez had spent much of the race bottled up in the lower half of the top 10 until being released when Ma Qing Hua spun on the final lap.
He then powered past the works Hondas of Gabriele Tarquini and Tiago Monteiro on the back straight to arrive in his team-mate's mirrors as the chequered flag flew.
Monteiro led most of the first lap from reverse-grid pole, and he survived an early challenge from Muller before succumbing at the end of the lap.
Fellow front-row starter Tom Coronel's ROAL Chevrolet was shuffled down the pack as Muller and Tarquini came through, soon to be followed by the semi-works Citroen of Mehdi Bennani and the factory C-Elysees of Ma, Lopez and Sebastien Loeb.
Loeb survived an early contact with Rob Huff's Lada as the field entered the Nordschleife on the opening lap, but he was relegated to a spectator role as the battle unfolded ahead.
The gaps ebbed and flowed as Muller initially gave himself some breathing space before the Hondas caught him again at the beginning of the final lap.
Lopez was harrying Ma, who in turn was bullying Bennani, as the battle for fourth caught the battle for the lead.
Ma went by Bennani on the run to Tiergarten at the end of the penultimate lap, and Lopez then barged through at Turn 1.
Still under pressure, Ma went into a spin at the exit of Aremberg and slewed sideways across the track, shedding enough speed for the final impact with the barrier to be relatively gentle.
Lopez narrowly avoided his team-mate's accident and pressed on to join the battle for the lead.
By Dottinger Hohe he was on Tarquini's bootlid and slipstreamed past up the straight, gaining enough momentum to pass Monteiro as well and arrive on Muller's tail as they rejoined the grand prix loop.
Confounding expectations that the field would stretch out on the long lap, the top four were separated by just seven tenths of a second, and ninth-place finisher Jaap van Lagen crossed the finishing line just 10 seconds after the winner.
The 2022 MotoGP season was another hotly contested championship, with Francesco Bagnaia emerging as the title winner after the campaign went to the wire. Autosport picks out the 10 best performers of the season
It’s regarded as one of the classic sportscar venues in the world. The Sebring International Raceway has been hosting top line endurance events for over seventy years and is one of the oldest continuously-operated racing circuits in the United States. Sebring is the venue for round four of the Le Mans Virtual Series — the number one eSports championship for the world’s best simulator and professional race drivers — in association with LEGO® Technic™ and its stunning #51 AF Corse Ferrari 488.
Volvo gave the World Touring Car Championship a major boost when it announced it would enter the series, but its ambitions don't stop there. JACK COZENS examines its programme, the S60 and what its arrival means for the WTCC
The 2012 World Touring Car champion says he never had the money to race cars. Yet 2015 is his 11th season in the WTCC. He talks STUART CODLING through his journey from motorsport fan to paid professional - for little more than £100,000