The main theme of Roald Dahl's Matilda is that good triumphs over evil. It's a David and Goliath story of the seemingly weaker underlings triumphing over the bully.
The bully in this story is the aptly named Mrs. Trunchbull, the headmistress of Crunchem Hall Primary School. This Nazi-like woman is likened to an "enraged rhinoceros" who terrorizes children and teachers.
When Miss Honey, Matilda's sweet and pretty teacher, tells Mrs. Trunchbull that Matilda is a genius who needs more stimulation and should be moved to a higher class, Mrs. Trunchbull decides Matilda is bad and refuses to move her.
Meanwhile, Mrs. Trunchbull continues to bully and terrorize everyone in her path, and Matilda's indifferent parents continue to ignore her.
However, Matilda triumphs when she realizes she can move objects just by using her immense mental powers. She manages to write with chalk on the board from a distance, terrorizing Mrs. Trunchbull, especially as the note she composes, seemingly written by a ghost, tells Mrs. Trunchbull to right the wrongs she has done to people.
Mrs. Trunchbull flees, and Miss Honey comes into money, so she is able to adopt Matilda.
The book has a feel-good ending of good triumphing over evil, but it is a particular kind of good. In Dahl's books, good people are kind, loving, gentle and attentive, intelligent, and up against a much more powerful antagonist.