Connect to share and comment
The Canadians ensured advancement to a first ever quarter-final against Italy in April.
Raonic and Frank Dancevic won opening singles matches on Friday to put the Canadians on the brink but Spain stayed in the hunt to the final day with a doubles victory on Saturday.
Spanish captain Alex Corretja replaced Marcel Granollers, who played in both of the first two days, with Davis Cup debutante Garcia-Lopez but the move failed to pay off.
Raonic saved a break point in the fifth game of the match with a backhand winner and never faced another break point the rest of the way.
Raonic broke in the sixth game of the first set on a forehand winner and held his way to take the set, then broke Garcia-Lopez to open the second set and twice more in the third set to secure the triumph after 1 hour, 57 minutes.
The Spaniards were without stars Rafael Nadal, David Ferrer, Fernando Verdasco and Nicolas Almagro.