David Nalbandian had brushed aside Spain No. 1 David Ferrer 6-3, 6-2, 6-3 in the opening singles, and del Potro was expected to comfortably handle Lopez on his favored hard-court.
But Lopez played the two tiebreakers better, and del Potro injured his right thigh in the sixth game of the fourth set. After treatment, he resumed and lost his service game and Lopez cruised to a memorable victory after 3 hours, 19 minutes, hushing the boisterous crowd of 10,000 at Islas Malvinas Stadium.
"I never felt this happy before in my career,'' Lopez said. "It's great to win a match like today, in a Davis Cup final, away from home.''
Del Potro's injury and his defeat suddenly made Saturday's doubles even more crucial for Argentina, a heavy favorite to win its first Davis Cup, and unbeaten at home for 10 years.
Nalbandian was picked to join Agustin Calleri against the veteran and tough Spanish pair of Lopez and Fernando Verdasco.
The manner of Nalbandian's easy and quick singles win likely persuaded Argentina captain Alberto Mancini to play him. He has a 10-4 record in Davis Cup doubles, and a 2-1 record with Calleri.
Del Potro is scheduled to open the reverse singles on Sunday against Ferrer, depending on the seriousness of his thigh injury.
"The doctor could not make a diagnosis right now,'' del Potro said. "I don't know what the injury is, tomorrow we'll find out what happened.''
After winning the first set, del Potro couldn't break Lopez again in the second as they headed into a tiebreaker. There, Lopez jumped to 4-0 and won it 7-2.
"I wasn't feeling comfortable in the first set,'' Lopez said. "But I was able to overcome that moment. I'm glad I was able to do that.''
There were no breaks either in the third, in which Lopez won five straight points in the tiebreaker and clinched the set with one of his 17 aces that silenced the crowd.
In the fourth set, Lopez broke del Potro in the fourth game but del Potro came right back with a break of his own.
Del Potro was trying to reach a crosscourt shot on the baseline when he injured himself. He left the court to be attended by doctors but when he returned he was obviously affected by the injury.
Lopez's win bolstered Spain's hopes of winning its third Davis Cup, and first away from home. After star Rafael Nadal withdrew with knee tendinitis this month, Spain's chances were diminished considerably, but it promised to fight for every point.
Ferrer, however, was routed by Nalbandian in under two hours.
Nalbandian broke Ferrer in the third game and led all the way, hitting 54 winners and making only 27 unforced errors.
"I played a great match,'' Nalbandian said after his 17th win in 21 Davis Cup singles. "I couldn't have played it any better. It was good to win it fast. I was always ahead, that gave me tranquility.''
Ferrer still leads their head-to-heads at 6-4, but all of Nalbandian's wins have been on hard-courts.
"No match against David is easy but I didn't have good feelings on the court,'' Ferrer said.
Argentina hosts Nadal-less Spain in Davis Cup
Torres: There Is A Great Campaign Behind Casillas
Agüero: I Still Have Much To Learn
Nalbandian to face Ferrer to open Davis Cup final