The Tragical History of Hamlet: Prince of Denmark, 1603
Excerpt from The History of Hamlet:
Saxo Grammaticus ("Saxo the Literate", literally "the Grammarian") publishes his Gesta Danorum ("Deeds of the Danes"), a work of Danish history that includes Vita Amlethi ("The Life of Amleth") which interweaves several older legends into a tale that bears, for the first time, some resemblance to Shakespeare's Hamlet including a king murdered by his brother, a prince that feigns madness, his queen mother's hasty marriage to the usurper, the prince killing a spy hidden in his mother's chamber, and the alteration of a letter by the prince in order to substitute the execution of two retainers for his own. However, the story also differs significantly from Shakespeare's version. Grammaticus' Amleth achieves revenge without sacrificing his own life, becomes King of Denmark, marries the Queen of Scotland, and finally dies in battle.
Link to the source, full timeline and history: Hamlet: Prince of Denmark website - http://www.hamlet-shakespeare.com/history/
Reproduction of the first edition of Hamlet, print in London in 1603.
Image source - Circulating Collection, Print and Picture Collection, Free Library of Philadelphia. Subject: "Hamlet" -- Shakespeare.
Original source: The world and its people: United Kingdom and Ireland. New York: Greystone, 1963, p.133.