The ghost let Hamlet and the audience know about the Claudius' s events.

However he also let them know of previous events,  besides it seems that its function is to create doubts in the audience, because just Hamlet is able to see the ghost,so the question that arises between the public is: is Hamlet mad or are the others the ones who are not able to see the ghost?

fabbricascema Everything depends on Hamlet ,in fact Shakespeare decides not to let Gertrude see the ghost so from this fact arises the doubt in the audience whether it really exists or it doesn't.

The ghost is the Hamlet's father and he appears three times during the film.

The first appears to the friends of Hamlet suggests that they shared his suspicions and perhaps even anticipated them ,though no word had been spoked.