Yes. Hamachi is legitimate virtual private networking software, and using it is entirely legal.
The only caveat is that some games' terms of service frown on it for online play, so check the rules of the specific title you want to use it with.