Suspend the magnet of known poles so that it can swing freely. Next, bring one pole of the other magnet near this. If they repel each other then they have similar poles while if they attract they are of opposite sign.

Copyright warnings! Do not copy.