The current world number 15 started the encounter brightly as he claimed one break of Giraldo's serve to take the opening set 6-3.
However, Colombia's Giraldo responded positively, particularly while serving, and went on to overturn Raonic's lead with a quickfire 6-4 6-3 double.
Giraldo looked to be heading for the second round when he went a break up early in the fourth set. His Canadian opponent refused to give up his place in the draw though, and he eventually overturned the deficit to win 6-4, forcing a decider in the process.
Many of the games in the fifth set went to deuce point, but it was Raonic who held his nerve to record a 6-4 victory.
He will now take on Paul-Henri Mathieu for a place in round three.