Religion is alluded to by Hamlet and spoken of directly in his opening soliloquy of Act I, scene ii ("Or that the Everlasting had not fix'd/His canon 'gainst self-slaughter"). However, the play's most striking infusion of Christian ethics relates to the ghost's decree to Hamlet to "[r]evenge his foul and most unnatural murder." As Kenneth Muir notes in his essay on the Ghost found in the Enotes Study Guide on Hamlet (linked below):
According to the various beliefs current in Shakespeare's day, a ghost could be. . . a spirit come from purgatory by divine permission or a devil disguised as a dead person in order to lure the living into mortal sin.
And whichever of these the Ghost might be is crucial to Hamlet's decision to follow its words and guidance or not. Christian doctrine would dictate that he shun the request of a "devil" but pursue and complete the request of "a spirit come from purgatory by divine permission." But which one is this ghost? This is a major dilemma for Hamlet in the play, one that is resolved when Hamlet presents The Mousetrap and catches "the conscience" of his uncle, the murderer of his father.
So Hamlet's delay in revenging his father's murder is due, in part at least, to the question of whether the spirit of his father is divine or dammed. As a good Christian, Hamlet must decide which the ghost is before he takes the spirit's word at face value and pursues the commanded revenge. In this way, religion has a monumental affect on Hamlet and his choices/behaviour.
For more on the religious significance of the Ghost as it relates to Hamlet , please see the essays linked below.