The understrength five-times champions had struggled from the start of the tie in Vancouver and Raonic killed them off with a 6-3 6-4 6-2 win over Garcia-Lopez to secure Canada's first ever triumph at this level of the men's team competition.
Holders Czech Republic earlier moved into the quarter-finals with Tomas Berdych outlasting Swiss opponent Stanislas Wawrinka a day after the pair emerged from a marathon doubles encounter.
Berdych enjoyed a comparatively easy 6-3 6-4 3-6 7-6 victory over Wawrinka, to give the Czechs an insurmountable 3-1 lead, a day after he and Lukas Rosol edged a punishing seven-hour clash with Wawrinka and Marco Chiudinelli 24-22 in the final set.
The Czechs will now travel to Kazakhstan in April after the Central Asian country wrapped up a 3-1 victory over Austria on Sunday.
The US also fended off a fightback from Brazil in Jacksonville to secure a place in the last eight, where they will meet Serbia.
Sam Querrey finished the job with a 4-6 6-3 6-4 7-6 (7-3) victory over Thiago Alves in the final rubber after Thomaz Bellucci had tied the contest up at 2-2 by battling past big-serving John Isner 2-6 6-4 6-7 6-4 6-3.
Italy also booked their place in the quarter-finals, where they will meet Canada, after Fabio Fognini beat Croatia's Ivan Dodig in a decisive fifth rubber.
Spain, without Rafa Nadal, David Ferrer and Nicolas Almagro, were on the back foot from the start of the tie on the Vancouver hardcourts after going 2-0 down in the opening singles on Friday.
The five-times champions wrestled their way back into the contest after a doubles victory on Saturday but Raonic put paid to any hopes of a remarkable comeback in the first reverse singles on Sunday.
The big-serving world number 15 opened his match against Garcia-Lopez - a late replacement for Marcel Granollers - with three aces and fired down 22 in all in the victory to the delight of a passionate crowd at the Thunderbird Sports Centre.
"It's pretty amazing," Raonic said. "It's something we should all be proud of. It's something I hope resonates not only with our team but throughout tennis in Canada."
The Czechs came into the final day with a 2-1 advantage and Berdych took three hours and 15 minutes to wrap up a four-set win over an equally weary Wawrinka, who had defeated Rosol in the singles on Friday.
"This is a team event and the people we have in the team have magic hands. They did a really great job and they told me I would be ready," Berdych, who did not get to bed until 2am on Sunday after Saturday's exploits, told reporters.
"I was feeling good from the first point and was quite ready for a fifth set."
The match ended 3-2 after Switzerland's Henri Laaksonen won the dead fifth rubber 0-6 6-3 6-1 against Jiri Vesely.
Andrey Golubev gave a bloody nose to a player ranked 157 places above him with a 4-6 6-3 6-4 6-2 victory over Austria's Juergen Melzer to give Kazakhstan a place in the quarter-finals for only their second time.
It was Melzer's second singles defeat in three days and it proved decisive.
Fognini overcame Croatia's Dodig 4-6 6-4 6-4 6-4 to ensure Italy reached the quarter-finals for the first time since 1998.
The tie had gone to a fifth rubber after Croatia's Marin Cilic had beaten Andreas Seppi earlier in the day to level the encounter at 2-2.
France completed a 5-0 whitewash over Israel having already booked their place in the next round on Saturday along with Serbia and Argentina, who also won all five rubbers against Germany.
- Sports & Recreation
- Stanislas Wawrinka
- Tomas Berdych