Can I use a new iPhone 5S with AT&T if I'm on contract?

So a while back I broke my iPhone 5S. So I just sold it on ebay for parts and I think I'm going to buy a brand new iPhone 5S off of ebay. The one I want is brand new and never been used or activated. If I'm still on contract from my old iPhone 5S, can I use this new one that hasn't been activated? I may already know the answer but I just don't want to buy it and have something go wrong.

Added (1). The brand new one on ebay is an AT&T iPhone. Will it have to be factory unlocked in order to work? Or is it good to go and I can just take the activated sim card from my old 5S and put it in this new one?

Yes you can, you will have to pay to "unlock it" which means connect it to there service. So that's 25-30 dollars. Then they will activated and will you will pay the service amount! Hope this helped!