Both are correct. There's no grammatical preference. I had to look it up. I think 'spat' might be becoming outdated, and the word 'spit' is used both as the noun and verb. "There is spit on the floor." "I spit on the floor."
Hmm, in further thinking though as I write this, if you say, "I spit on the floor.", there is the possibility for miscommunication as to whether or not I am currently spitting or that I have spit. If I say, "I spat on the floor.", there is no misunderstanding. It's clearly understood that this was a past action.