suddenly, without planning in advance
Oxford100% of films
I just came on the spur of the moment.
"I didn't know what I was doing. I did it on the spur of the moment"?
Definitions from the Oxford Advanced Learner's Dictionary, 9th edition