The closing scene in Hamlet provides a restoration of order and and fit ending for the plot.
As expected in a tragedy, most of the main characters end up dead on stage. Gertrude is killed by accidentally ingesting poison meant for Hamlet. Her death spurs Hamlet, finally, to act. He learns from Laertes that both he and Laertes will die from the poisoned sword. Finally, Hamlet is able to muster the courage and power to exact his revenge on Claudius.
Beyond this, the audience learns that Hamlet's true story will live on through Horatio, who is thwarted by Hamlet from drinking the poison as well.
Finally, Denmark will have a capable leader in Fortinbras, who happens upon the carthage minutes after its conclusion. Even though an enemy country has taken over, Fortinbras has proven himself logical and able while also recognizing Hamlet's greatness by offering him a soldier's burial.
In the final scene of the play, Hamlet and Laertes fence one another in front of Claudius, Gertrude, and the other royal members of the court. Hamlet scores the first point in the match but refuses to drink the poisoned wine when Claudius offers it to him. Instead, Gertrude drinks from the same chalice after celebrating Hamlet's second point. Laertes then stabs Hamlet with the poisoned rapier, but after a quick scuffle, Hamlet manages to grab the poisoned sword and wound Laertes. Suddenly the queen collapses, and Laertes explains Claudius' treachery. Hamlet then wounds Claudius with the poisoned sword and forces him to drink the poisoned wine. The entire royal family dies, and Horatio tells the tragic story to Fortinbras so that Hamlet's memory lives on.
The fact that Hamlet finally avenged his father's death is significant to the final scene of the play. Since Hamlet is a tragedy, it is expected that several important characters lose their lives by the end of the play. It is also significant that Hamlet and Laertes make amends before passing away and Horatio agrees to keep Hamlet's memory alive by telling his story to Fortinbras. Despite Shakespeare's moral ambiguity and the unexpected deaths, Hamlet's story is retold throughout history by his loyal friend, Horatio.