Work in NJ and live in NYC

I will be working in New Jersey and living in NYC. How will I be taxed? will I receive credit for paying NJ taxes and just pay the difference that I owe to NYC?