Yes. The compass needle is a small, freely rotating magnet, so it obeys exactly the same rules as a bar magnet — its North pole is repelled by another North pole and attracted by a South pole.
The only difference is that the needle is very light and turns on a sharp pin, so instead of sliding away or moving closer as a whole, it simply swings round (deflects).