Verdasco, playing on his home turf, outlasted Raonic 6-4, 2-6, 7-6 (7) on Tuesday.
Raonic, seeded 12th, led 4-1 in the third-set tiebreaker of a match that lasted for more than two and a half hours at the Caja Magica, but let his mistakes get the better of his game in the key moments.
It was a bitter defeat for the right-hander from Thornhill, Ont., who struck a dozen aces and lost serve only once while saving six break points. Raonic has never passed the second round in the Spanish capital.
"I'm fairly disappointed with today, I didn't do what I needed to do," Raonic said. "I had too many mistakes, too much up and down. Consistency was an issue for me today.
"I had hopes when I led 4-1 in the tiebreaker and when I saved those two match points. But in the end I was missing shots by quite a bit or he was playing well. I was letting him get ahead in points. It all depended on me today."
Raonic put together a comeback after losing the first set and had it all to play for in the deciding set.
He came from 0-30 down to secure a 5-4 lead, but Vedasco answered, tying the set without allowing a point in front of his home crowd.
Raonic had to save three break points in the 11th game, finally smashing down an overhead to take a tight 6-5 lead. A game later, it went into a tiebreaker.
Raonic lost his 4-1 lead as Verdasco levelled, then took a first lead of the set when Raonic sent a forehand into the net.
Raonic fired his 12th ace to save a first match point, then profited from a Verdasco return long on a second. The Spaniard came lucky on his third from Raonic's forehand error.
"I should have done better than I did here. I'm capable of much better and hopefully I can show that," said Raonic, now 18-7 this season.
It was the third career match between Raonic and Verdasco. The Spaniard has won all three meetings on clay, while Raonic has prevailed in two hardcourt encounters.
Raonic and Verdasco, supported by a team in his box which included his father and Davis Cup captain Alex Corretja, played tough for almost an hour in the first set
It took the Spaniard four set points to get the job done, with Raonic saving one with his sixth ace to hold serve for 4-5. A game later, the Canadian salvaged two more Verdasco opportunities before the scooping a forehand just long over the baseline.
Raonic quickly shifted into recovery mode in the second set, breaking for a 3-1 lead. He then sent a forehand bomb down the line on set point to square the match at a set each.