The Ghost, first and foremost, serves to drive forward the plot. In I.i Horatio tells Hamlet about the sighting and Hamlet decides to try and see the Ghost himself. Hamlet does not meet with the Ghost until I.iv, however, without the initial sightings in I.i, Hamlet would never get the chance in I.iv to find out that his Claudius murdered Hamlet's father.
Also in I.i the guards interpret the sighting of the Ghost as an omen of bad things to come. They believe that the Ghost is fortelling of war with Norway in the near future.
I'm not sure that in I.i the Ghost serves more than those purposes, but throughout the rest of the play the Ghost serves several more purposes. For example, later on it echoes Hamlet's conscience as Hamlet explains to the Ghost that he feels guilty for not having acted yet on the knowledge that Claudius is a murderer.
Some scholars argue that in specific parts of the play the Ghost is representative of Hamlet's madness; particularly in the scene with his mother (III.iv) when she cannot see the Ghost that Hamlet swears is standing before them.