I get the idea that spells can be created by wizards from Order of the Pheonix, when <PERSON> tells <PERSON> about her mother's death. When <PERSON> asks her if she's known anyone who's died, she responds
"Yes, my mother. She was quite an extraordinary witch, you know, but she did like to experiment and one of her spells went rather badly wrong one day. I was nine."
This makes it sound as if <PERSON>'s mother was able to create her own spells, or at least attempt to do so with limited success.
<PERSON> thinks at first that many spells in his copy of "Advanced Potion-making" were invented by the Prince because they've been crossed out and re-written, but then when he talks to <PERSON> about "Levicorpus" <PERSON> makes it sound as if that spell was merely popular during his time at Hogwarts, and wasn't invented then. However, when <PERSON> attemps to use it against <PERSON>, he says
"No, <PERSON>! You dare use my own spells against me? It was I who invented them--I, <PERSON>! And you'd turn my inventions pn me, like your filthy father, would you?"
So, clearly, <PERSON> actually did manage to invent his own spells while he was at school.
We also learn from Mr. 573
<PERSON> that wizards are able to conduct their magic through many magical objects, and you will simply get the best results from a wand that has chosen you. Think of the sparks that <PERSON> makes issue from his wand when he first tries it in <PERSON>'s shop; that wasn't a particular spell, because he hadn't learned to produce sparks with a spell yet. Magic doesn't always have to be in spell form, and the sort of magic that underage wizards and witches are able to produce before they come to Hogwarts is often individual to each person. I would think that with enough study of magical theory, individuals would be able to harness this sort of magic and recreate it with their own incantation.
We know that potions are invented over the years because the Wolfsbane potion is said to be a recent invention by <PERSON> in Prisoner of Azkaban. The chocolate frog card about <PERSON> notes him for his work on alchemy with <PERSON>. This gives the idea that there is new magical reserach and innovation within the Wizarding World and people are always learning new ways to channel magic, so I think that spells can be created with enough work and trial and error. 194