Spain's Lopez began slowly and trailed 5-2 but he recovered strongly to take the first set before Coric, seeded seventh, clawed his way back to force a decider.
The 21-year-old Coric switched gears to go 5-4 up in the third set but could not prevent a dogged Lopez from securing victory in two hours and 45 minutes.
World number 71 Lopez next takes on Germany's Mischa Zverev or Filip Krajinovic of Serbia.
ATP Miami
Kyrgios continues sizzling start to 2022 with upset over Rublev
25/03/2022 AT 21:23
Briton Kyle Edmund also sealed his place in the next round with a 3-6 6-1 6-2 win over Germany's Peter Gojowczyk. The fifth seed fired 13 aces to progress in one hour and 31 minutes.
Russia's Karen Khachanov powered past American Sam Querrey 6-4 6-4.
Top seed Juan Martin del Potro of Argentina, bidding for his third title of the season, begins his campaign against Spain's Albert Ramos-Vinolas on Tuesday.
ATP Acapulco
Zverev beats Brooksby at 4.55am to set record for latest-ever finish
22/02/2022 AT 14:46
Davis Cup
Germans exact revenge as Evans calls for rule change - Davis Cup Finals diary
30/11/2021 AT 23:29