Yukiteru "Yuki" Amano is a loner who never really interacts with people and prefers writing a diary on his cell phone with his imaginary friends Deus Ex Machina, the God of Time and Space, and Muru Muru, Deus's servant. However, Yuki soon learns that Deus is real when he makes Yuki participate in a battle royal with eleven other people. Within this "Diary Game," the contestants are given special diaries that can predict the future, with each diary having unique features that gives them both advantages and disadvantages. The rules of the game are simple: the contestants have 90 days to find and kill all the other contestants, and the last one standing will become the new God of Time and Space.
Yuki initially has no desire to win the game, but after Deus informs the other contestants that Yuki, as the "1st" Diary owner, is his favorite to win the game, he is forced to team up with the 2nd Diary owner--his obsessive stalker, Yuno Gasai--in order to survive the constant attempts on his life by the other diary users, who see him as the biggest threat. At first, Yuki feigns affection for Yuno to manipulate her into protecting him, and because he is too afraid to spurn her after witnessing the terrifying lengths she is willing to go to in order to preserve their "Happy End" (a prediction in Yuno's diary that she and Yuki will "become one" on July 28, the 90th day of the game), but his declarations of love become increasingly sincere over the course of the game despite the mounting evidence that Yuno is hiding something from him. Even as he learns that he cannot trust any of the other contestants, who are willing to cheat, lie, manipulate, and kill for the sake of winning, Yuki continues to trust Yuno because her feelings for him are genuine and because he is unwilling to stoop to the level of the other contestants in order to survive by himself.
All that changes when, late in the game, Yuki's parents are murdered. Upon learning from Yuno that he can bring his parents back to life by becoming the new God of Time and Space, Yuki becomes a ruthless, backstabbing, and manipulative terrorist who no longer has any qualms about taking innocent human lives for the sake of killing the other contestants. Yuki's actions shock his friends, in particular Aru Akise, who has suspicions about Yuno and her motives. After Yuno and Yuki become the last contestants, Aru and the rest of Yuki's friends chastise him on how he has become just as bad as the other contestants. Aru tries to warn Yuki that Yuno is manipulating him and that she has an ulterior motive. Refusing to accept the truth, Yuki ignores their warnings that the God of Time and Space cannot revive the dead and kills his friends under the pretense that he can bring them back to life later. In one last desperate attempt to convince Yuki of the danger he is in, Aru sacrifices his life, refusing to dodge a fatal blow from Yuno in order to give Yuki a clue about Yuno's true identity.
As the "Happy End" draws near, Yuki begins to wonder about the Aru's final clue. When he unwittingly brings it up with Yuno along with his desire to commit double suicide rather than win by killing her, she attempts to kill him and he is forced to flee for his life. At this time, Muru Muru appears and reveals Yuno's secret to Yuki: Yuno is the God of Time and Space, Muru Muru is Yuno's servant whom she inherited from Deus, and the universe they currently reside in is actually a time paradox created when Yuno, the winner of the Diary game, used her new powers to travel back in time and start the game over. In the original Diary game, Yuki and Yuno also defeated all the other contestants and decided to commit double suicide. However, Yuno only faked her death because she believed that she could bring Yuki back to life with the powers of the God of Time and Space. In a cruel trick of fate, Yuno was able to resurrect Yuki's body but not revive his soul. Mad with grief, Yuno decided to travel back in time with Muru Muru, kill and replace her past self, have Muru Muru trap and replace her past self, and together manipulate the game to ensure that this time, the game ended with Yuki as the victor.
After Muru Muru finishes her explanation, Yuno appears and explains that the reason she wants to kill Yuki is because Yuki is expendable to her: she only needs to play the Diary game a third time if she wants Yuki to win. As Yuno is about to kill him, Yuki is saved by Minene Uryu, one of his allies and the supposedly deceased 9th Diary user. Prior to his death, Deus granted her a part of his power so that she could confirm his suspicions that Yuno and Muru Muru are from a parallel universe and prevent them from disrupting the Diary game. Their plans foiled, Yuno and Muru Muru travel back in time to start the Diary game a third time, but are followed by Yuki and Minene. Minene tampers with the new universe, ultimately preventing many of the terrible events that originally happened to the other diary owners. As a result of this, Yuno finds that her parents in the new universe were never abusive and loses her resolve to kill and replace that universe's Yuno. Yuki convinces Yuno to come to her senses and surrender as he loves her, requesting that she kill him and return to his universe to create a better world for herself. Regretting her mistakes, Yuno instead kills herself as she loves Yuki too much, ending her life and making Yuki the new God of his universe.
With Yuno and all of the other diary holders dead, Yuki is made Deus' successor as God of Time and Space. However, devastated by Yuno's death, Yuki does nothing with his powers, instead spending all of his time mourning his loss of Yuno and everyone he loved. 10,000 years pass by with Yuki continuing to mourn; however, to Yuki's surprise, the Yuno of a new universe breaks through time and space, recognizes Yuki, and invites him to come to her universe. Muru Muru reveals that she contacted her counterpart Muru Muru in Yuno's universe and that they together implanted Yuno with her memories from the past universe. In the new universe, Deus calls off the Diary game and makes Yuki and Yuno his heirs, and the series ends with Yuki reuniting with Yuno, his friends, his parents, and the Diary users in the new, happier universe.