Midnight Magic by Avi is a middle grade novel of excellent quality.
Fabrizio is a young boy who is servant to a sleight-of-hand magician, Mangus, in 1491 Italy. In an age of superstition, sleight of hand looks like real magic. Mangus has already been tried for demonic magic and put under house arrest. Suddenly, a knock at the door on a stormy midnight brings Mangus and Fabrizio into the King's stronghold. He is ordered to free the princess from the haunting of a spirit she claims is the ghost of her murdered brother.
The story goes on with Fabrizio overhearing things he can't tell, being told things under oath of secrecy, losing his way and finding his way through secret passages, and finally, helping Mangus to raise the spirit of the missing prince.
I can't tell you much more without ruining the story. I think even an adult will enjoy this tightly-twisted tale told by an expert storyteller.