Matthew Morrison will perform one of his own songs in the 'Glee' season two finale.

The actor -- who plays teacher Will Schuester in the musical TV show -- is set to sing 'Still Got Tonight', the single from his debut self-titled album, in the New York-themed episode.

The ballad, which was co-written by former 'American Idol' winner Kris Allen, will be played by Matthew alone on an empty theatre stage.

He told The Hollywood Reporter: "It was going to be just a big dance piece with me doing this big dance number. But they said, 'We want you to sing it and make it a big moment.'"

Dana Walden, 20th Century Fox Television chairman, agreed to allow the track to be put in the finale -- which airs on May 24 -- only if it fitted the character.

'Glee' creator Ryan Murphy said: "It's about aspiration. It worked because we wanted to do a scene where Matt goes into a Broadway hall and sings something alone. Plus, Matt is such a great team player and he's done so much for different 'Glee' charities.

"We worked really hard to make it feel organic to the show."

Matt recently confirmed there would be a death at the end of the second season of 'Glee'.

He said: "Somebody's dying. Obviously I'm not going to tell you who it is, but it is no-one you would probably expect.

"The episode right before the finale is called 'Funeral'."