+1 - Great post above by Tim! There's a lot of helpful information there.
When trying to achieve a certain sound, it definitely helps to know what gear/effects the artist originally used, and get as close to that as you can when "chasing" their tone. If they were playing a Les Paul through a Marshall using a Boss DS-1 pedal and flanger, you're not going to come anywhere close if you're playing a Strat through an AC30 using a Digitech Bad Monkey!
Tim's #1 point is crucially important too - probably even more important than the gear itself! For example, you could plug me into Eddie Van Halen's rig and I'd sound nothing like him, because I can't play like he does. He makes extensive use of tapping, pinch harmonics, sweep picking and lots of subtle little things that you hardly notice, but make a big difference in his sound. If you plugged Mark Knopfler into EVH's rig, it would sound like Mark Knopfler - but through EVH's rig. Their playing styles are very different and they use different techniques. You could hand either one of them a $99 Squier guitar plugged into a Pignose amp and their playing would still be immediately recognizable.
Technique may not be as important if you're trying to play like a guitarist with a less distinctive sound. If you're just going after the generic heavy metal "Drop D, chugga chugga" sound and you can play that kind of stuff, then it's all about the gear....but if you're trying to ape someone with a "signature" sound like Steve Vai, Joe Satriani, Brent Mason, Brad Paisley, Pete Anderson (sorry, my country music roots kicking in!), etc., then it's technique before gear.