Before setting up your phone, run a hard reset, thus putting everything back to factory default. I can't see how spyware could survive that. If you've already set it up--sorry, but this will cause data loss and you'll have to set it up all over again. Make sure you have copies of anything important.
After that, just to be sure...One free app you can download is Incognito Anti Spyware. Download, install. Run it. If you feel safe enough to rely on this without doing a hard reset, I imagine you could. If, when you booted your new device for the first time, it took you through the setup sequence, that's a pretty good sign it was already wiped. Still, on the rare occasions when I have bought used phones, though, the first thing I do is a hard reset. That's not so much a security concern, but just wanting to make sure my device is fresh and not relying on Seller to have done it right.
You can also use more typical apps like Malware Bytes and AVG AntiVirus (and should), but Incognito seems to be what fits your request best.