In Act V Sc.1 we listen to Hamlet telling Horatio, how by stealing the letter written by Claudius that contained the instructions to the King of England to have him executed and by substituting it with a forged letter to have instead the bearers of the letter, Rosencrantz and Guildenstern to be executed he escaped death and has now returned to Denmark.
In the next scene Laertes, just before he dies exposes the villainy of Claudius. Claudius has arranged for a fencing match between Laertes and Hamlet. In order to ensure that Laertes kills Hamlet, Claudius has poisoned the tip of Laertes' fencing sword. Furthermore, he has also poisoned the wine which is to be offered as refreshment and also to toast every successful hit of Hamlet's. As luck would have it the swords of Hamlet and Laertes get exchanged during the fencing match and Laertes and Hamlet are both poisoned. Laertes immediately exposes the villainy of Claudius. Hamlet kills Claudius atonce with the poisoned sword. Gertrude, meanwhile is already dead having drunk the poisoned wine when she toasted a successfult hit of Hamlet's.
So, in ActV Sc.1 Claudius uses Rosencrantz and Guildenstern to have Hamlet executed in England. In the very next scene he uses Laertes to kill Hamlet with the poisoned fencing sword. Both these attempts to kill Hamlet end in failure. Finally, Hamlet kills Claudius with the poisoned sword and Laertes remarks, "he is justly served."