I'd say it like this: "It was Beethoven's Moonlight Sonata". You could also say "It was Beethoven: The Moonlight Sonata." I don't think that saying "It was a Beethoven, 'The Moonlight Sonata' " sounds idiomatic in US English.
You might say "It was a Beethoven work/piece", but that type phrase is used much more often to refer to paintings and artwork, not musical pieces. It is very common to say or hear "It was a Renoir/Monet/Dalí."