It could be that something was inserted into your database, but that’s not the only thing that could be wrong.
I’m not sure re-importing just the posts would be the best way to go, it really depends on how you’re using WordPress. If you have a lot of users, taxonomy, etc then you’d lose all that as well.
I found a site about cleaning up a hacked WP blog — it’s a bit old but has some general recommendations for cleaning up.
Basically you’ll want to examine the database, look through the theme files, look through wp-uploads. Backup and Upgrade!
Also note that it’s likely you were hacked due to a since-patched vulnerability in WordPress, but even fully updated sites can become compromised due to server vulnerabilities. I guess the advice there is to stay vigilant.