Yes assuming you are in range and have an instant cast ability and aren’t under a GCD or some other constraint, and in some case also requires the rogue to be in front of you.
And yes if a bad rogue let’s you see him before jumps you then you can target him more easily, but then that’s the rogues fault.
So once again Spy does not automatically break a rogue out of stealth or let you target through stealth.