"Out of spite" is a set phrase.
New Oxford American Dictionary
spite | spaɪt |
a desire to hurt, annoy, or offend someone: he'd think I was saying it out of spite.
BrE /spaɪt/ ; NAmE /spaɪt/
Oxford Learner's Dictionaries
[uncountable] a feeling of wanting to hurt or upset somebody
I'm sure he only said it out of spite.